Supposedly, I have the following class
:
class Foo {
int i;
public:
Foo(int const i_) : i(i_) {}
int geti() const { return i; }
};
and the following piece of code in main
:
Foo* centroids = new Foo[5]{{1}, {2}, {3}, {4}, {5}};
GCC compiles and runs it with no problem demo, while CLANG gives a compile error demo
error: no matching constructor for initialization of 'Foo'
So which compiler is right?
Aucun commentaire:
Enregistrer un commentaire