[Bug c++/90849] Gcc accepts invalid code

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 12 08:16:00 GMT 2019


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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:

template <typename T>
struct A 
{
  A () : A<int> ( 1 ) { }
  A (int);
};

A<int> a;

G++ and MSVC accept the delegating constructor, Clang and EDG reject it.

It's not immediately obvious to me that this is invalid, because the
base-specifier does name the class, making it a valid delegating constructor.
It would be invalid in any other specialization of the class template, but
that's OK. As long as there is one valid specialization it should be accepted.


More information about the Gcc-bugs mailing list