[Bug c++/86961] New: ICE in finish_member_declaration when an alias template is used

v.reshetnikov at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Aug 14 21:26:00 GMT 2018


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

            Bug ID: 86961
           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<class>
    struct Inner;

    template<class T>
    using Alias = Inner<T>;
};

template<>
template<class T>
struct Outer<bool>::Inner { 
    static constexpr auto value = sizeof(T);
};

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);
   |                           ^~~~~
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.


More information about the Gcc-bugs mailing list