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

            Bug ID: 86958
           Summary: ICE in finish_member_declaration when an alias
                    template is used
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: v.reshetnikov at gmail dot com
  Target Milestone: ---

/********************** BEGIN SOURCE **********************/
template<class>
struct Outer {
    template<bool>
    struct Inner;

    template<bool x>
    using Alias = Inner<x>;
};

template<>
template<bool v>
struct Outer<void>::Inner { 
    static constexpr bool value = v;
};

static_assert(Outer<bool>::Inner<bool>::value == sizeof(bool)); // OK
static_assert(Outer<bool>::Alias<bool>::value == sizeof(bool); // error

/*********************** END SOURCE ***********************/

The first static_assert compiles OK, but the second results in an ICE:

/********************** BEGIN OUTPUT **********************/
<source>: In instantiation of 'struct Outer<bool>::Inner<bool>':
<source>:17:39:   required from here
<source>:13:27: internal compiler error: in finish_member_declaration, at
cp/semantics.c:3085
13 |     static constexpr auto value = sizeof(T);
   |                           ^~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1

/*********************** END OUTPUT ***********************/

This issue was found with build 9.0.0 20180813 (experimental), but appears to
exist in earlier versions as well.

For comparison, Clang compiles this code successfully.

Reply via email to