- Notifications
You must be signed in to change notification settings - Fork14.5k
Closed
Description
Bugzilla Link | 52251 |
Version | trunk |
OS | Linux |
CC | @AaronBallman,@zygoloid |
Extended Description
At least with Clang 13 and recent Clang 14 trunk,
$ cat test.cc
struct S {
consteval S() {}
int a;
};
S s2;
$ clang++ -std=c++20 -fsyntax-only test.cc
erroneously succeeds, while e.g. with GCC 11 it fails with
$ g++ -std=c++20 -fsyntax-only test.cc
test.cc:5:3: error: ‘S()’ is not a constant expression
5 | S s2;
| ^~
test.cc:5:3: error: ‘s2.S::S()’ is not a constant expression because it refers to an incompletely initialized variable
(I think this is different from bug 51560, as the initialization of s2 here asks for default-initialization via the S() constructor.)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done