[Bug c++/16582] Wrong diagnostic when using "[1]" as template argument

2021-07-31 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16582

--- Comment #4 from Andrew Pinski  ---
C++11/C++14/C++98 gives:
:8:13: error: template argument 2 is invalid
8 | X x3; // ERROR
  | ^

While C++17 gives:
:8:8: error: '& p[0]' is not a valid template argument of type 'char*'
because 'p[0]' is not a variable
8 | X x3; // ERROR
  |^

And C++20 accepts the code.

Note clang accepts the code for C++17 and C++20.

[Bug c++/16582] Wrong diagnostic when using "[1]" as template argument

2018-09-13 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16582

Manuel López-Ibáñez  changed:

   What|Removed |Added

   Last reconfirmed|2005-05-09 00:48:28 |2018-9-13
  Known to fail||

--- Comment #3 from Manuel López-Ibáñez  ---
Clang:

:8:9: error: non-type template argument does not refer to any
declaration
X x3; // ERROR
^~~~
:1:25: note: template parameter is declared here
template struct X {
^