Issue 162027
Summary [clang] "incomplete type 'const A' is not a literal type" for a static constexpr data member
Labels clang
Assignees
Reporter mmatrosov
    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 {
      | ^
```

https://godbolt.org/z/YbvW4Gq3n
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to