Clang fails to compile

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Clang fails to compile

Kristof Beyls via cfe-dev
Hi Devs,
Consider below testcase

$cat test.cpp

struct A
{
struct B
{
double m = 0.;
};
void f(double d, const B &b = B{}) {}
};

==============

clang fails fails to compile above tescase ,while it goes smooth with
icc and msvc.
is clang doing right?

./Kamlesh
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Clang fails to compile

Kristof Beyls via cfe-dev
GCC also rejects this: https://godbolt.org/z/O7FSC6

So I'm leaning towards Clang/GCC probably being correct - but CC'ing Richard Smith: I would've thought the enclosing class of 'm' would be B, and so the default member initializer wasn't needed before the end of /that/ enclosing class. But I guess I'm wrong here?

On Thu, Oct 31, 2019 at 9:18 AM kamlesh kumar via cfe-dev <[hidden email]> wrote:
Hi Devs,
Consider below testcase

$cat test.cpp

struct A
{
struct B
{
double m = 0.;
};
void f(double d, const B &b = B{}) {}
};

==============

clang fails fails to compile above tescase ,while it goes smooth with
icc and msvc.
is clang doing right?

./Kamlesh
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev