mercredi 6 septembre 2017

Why does g++ accept a reference type with missing underlying type?

I was meaning to add a copy constructor to a class but I forgot to add the type. g++ 5.4.0 compiled the program successfully.

Here's a minimal program that g++ 5.4.0 compiles and builds successfully.

struct Foo
{ 
   Foo(const&) {}
   Foo() {}
};

int main()
{
   Foo f1;
   Foo f2 = f1;
}

Why does g++ not report Foo(const&) {} as an error?

Aucun commentaire:

Enregistrer un commentaire