https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98367

            Bug ID: 98367
           Summary: ICE with CTAD non-type template parameter
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jbassett271 at gmail dot com
  Target Milestone: ---

This ICEs the compiler with a segfault (see https://godbolt.org/z/ddceoM ):

template <typename A>
struct ctad_t {
    A a;
};

template <ctad_t T>
struct myclass {
};

template <typename Something>
constexpr auto myobject = ctad_t {Something::value};

template <typename Something>
using thing = myclass<myobject<Something>>;


Compiled with (grabbed from the Compiler Explorer link): g++ -g -o output.s
-masm=intel -S -fdiagnostics-color=always -std=c++2a example.cpp

I have also confirmed this on my own machine with gcc version 10.1.0.

Tested with GCC versions on Compiler Explorer:
 - gcc version 11.0.0 20201216 (experimental)
 - gcc version 10.2.0
 - gcc version 10.1.0
 - gcc version 9.3.0
 - gcc version 9.2.0
 - gcc version 9.1.0
 - gcc version 8.3.0
 - gcc version 8.2.0
 - gcc version 8.1.0

These also segfaulted with -std=c++1z instead of -std=c++2a:
 - gcc version 7.5.0
 - gcc version 7.4.0
 - gcc version 7.3.0
 - gcc version 7.2.0
 - gcc version 7.1.0

Earlier versions did not support CTAD.

Inlining the `object` variable does not segfault, but emits a message about
being unable to perform CTAD: https://godbolt.org/z/drWT6h

Reply via email to