-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"constexprAnything related to constant evaluationAnything related to constant evaluationdiverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issue
Description
Not sure if this is a bug or not, bug gcc compiles this code just fine:
template<typename Base>
struct Mixin {
static constexpr Base base{};
};
struct A {
Mixin<A> m;
};
while clang argues:
<source>:3:25: error: constexpr variable cannot have non-literal type 'const A'
3 | static constexpr Base base{};
| ^
<source>:7:14: note: in instantiation of template class 'Mixin<A>' requested here
7 | Mixin<A> m;
| ^
<source>:3:25: note: incomplete type 'const A' is not a literal type
3 | static constexpr Base base{};
| ^
<source>:6:8: note: definition of 'A' is not complete until the closing '}'
6 | struct A {
| ^
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"constexprAnything related to constant evaluationAnything related to constant evaluationdiverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issue