A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/llvm/llvm-project/issues/51593 below:

Invalid consteval constructor invocation does not cause an error · Issue #51593 · llvm/llvm-project · GitHub

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.)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4