[Bug c++/100997] New: [c++20] parse error when id-expression of constructor is simple-template-id

2021-06-09 Thread felix.morgner at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100997

Bug ID: 100997
   Summary: [c++20] parse error when id-expression of constructor
is simple-template-id
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: felix.morgner at gmail dot com
  Target Milestone: ---

Created attachment 50972
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50972&action=edit
Example source file

In C++20 mode, GCC 11.1 rejects the following code:

  template
  struct A;

  template<>
  struct A {
A() {}
  };

With the following error:

  :6:12: error: expected unqualified-id before ')' token

I currently don't have access to my copy of the standard, but working from both
https://wg21.link/std and https://wg21.link/std20, I am under the expression
that this code should be valid since:

According to [class.ctor], the sole id-expression of the ptr-declarator of the
ctors function declarator may be the injected-class-name. [class.pre] tells us
that the class-name of the class being declared is injected into scope of the
class, where it is called the injected-class-name. Moreover, [class.pre]
defines a class-name to be either an indentifier or a simnple-template-id. I
would argue that in the case of the explicit specialization above, A would
be a simple-template-id and thus a valid injected-class-name.

The error does not occur in C++17 mode or in GCC prior to version 11.

Tested in all cases with "-Wall -Wextra -Werror -pedantic-errors"

[Bug c++/100997] [c++20] parse error when id-expression of constructor is simple-template-id

2021-06-09 Thread felix.morgner at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100997

--- Comment #3 from Felix Morgner  ---
Thank you for the quick response. I will file a bug report with Boost GIL.