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

            Bug ID: 94057
           Summary: [9/10 Regression] -std=gnu++20 causes failure naming
                    nested templated class
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: romain.geissler at amadeus dot com
  Target Milestone: ---

Hi,

The following snippet fails with gcc trunk and with gcc 9 if I compile with
-std=gnu++20, but not with -std=gnu++17. gcc <= 8 or any clang version happily
compiles it whatever -std value I use.

template <typename T> class A
{
    template <typename... Types> class B
    {
        B(const A<T>::B<Types...>&) = default;
    };
};

It reads:

<source>:5:23: error: 'typename A<T>::B' names 'template<class T>
template<class ... Types> class A<T>::B', which is not a type
    5 |         B(const A<T>::B<Types...>&) = default;
      |                       ^~~~~~~~~~~
<source>:5:34: error: expected unqualified-id before '&' token
    5 |         B(const A<T>::B<Types...>&) = default;
      |                                  ^
<source>:5:34: error: expected ')' before '&' token
    5 |         B(const A<T>::B<Types...>&) = default;
      |          ~                       ^
      |                                  )
<source>:5:34: error: constructors may not be ref-qualified
<source>:5:34: error: expected ';' at end of member declaration
    5 |         B(const A<T>::B<Types...>&) = default;
      |                                  ^
      |                                   ;
<source>:5:35: error: expected unqualified-id before ')' token
    5 |         B(const A<T>::B<Types...>&) = default;
      |                                   ^
Compiler returned: 1

Cheers,
Romain

Reply via email to