[Bug c++/101221] Inaccurate error message for wrong template alias

2022-11-07 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101221

Jonathan Wakely  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #2 from Jonathan Wakely  ---
Reduced:

namespace x
{
  template struct S;
}

template
using S = x::S;


Which means this is the same as 104091. This is older, but that one has more
info so I'll close this as the dup.

*** This bug has been marked as a duplicate of bug 104091 ***

[Bug c++/101221] Inaccurate error message for wrong template alias

2022-01-18 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101221

Jonathan Wakely  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2022-01-18

--- Comment #1 from Jonathan Wakely  ---
The code from the attachment is:

namespace One {
typedef enum { A, B } Type;

template  class AClass;

template 
class AClass { };

template 
class AClass { };
}

typedef One::Type NewType;

template 
using OtherNew = One::AClass;

class BClass {

typedef One::Type Type;

template 
using New = One::AClass;
};


With -std=gnu++17 we print:

101221.C:16:18: error: missing template arguments after 'AClass<...auto...>'
   16 | using OtherNew = One::AClass;
  |  ^~~
101221.C:4:43: note: 'template class One::AClass'
declared here
4 | template  class AClass;
  |   ^~
101221.C:23:17: error: missing template arguments after 'AClass<...auto...>'
   23 | using New = One::AClass;
  | ^~~
101221.C:4:43: note: 'template class One::AClass'
declared here
4 | template  class AClass;
  |   ^~


With -std=gnu++20 we print:

101221.C:16:18: error: 'auto' not allowed in alias declaration
   16 | using OtherNew = One::AClass;
  |  ^~~
101221.C:23:17: error: 'auto' not allowed in alias declaration
   23 | using New = One::AClass;
  | ^~~


Both diagnostics are wrong.

Clang prints the same error for C++17 and C++20.