-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue
Description
Hello,
I'm encountering issues with Clang when initializing nested, templated structs again. A similar, now solved issue is filed here.
I was able to boil it down to this:
https://godbolt.org/z/jvPeYed1x
template <typename T>
struct A {
T* a = nullptr;
};
template <typename T>
struct B {
struct {
A<T> aa;
} b;
};
float d[] = {0.1337};
A<float> aa = {d};
B<float> b = {
{aa},
};
template <typename T>
struct C {
B<T> b;
};
template <typename T>
T factory = {b};
C<float> c = {b};
int main() {
return factory<C<float>>.b.b.aa.a == nullptr ? 100 : 0;
// return c.b.b.aa.a == nullptr ? 100 : 0;
}I expect this to return 0.
This fails in Clang when using the factory. When instantiating C directly it works.
It fails in all Clang versions but works in GCC and MSVC.
Tagging the people involved in the previous issue because it seems very similar:
@shafik
@royjacobson
@erichkeane
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue