-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Open
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconstexprAnything related to constant evaluationAnything related to constant evaluation
Description
llvm-project/clang/test/SemaCXX/constant-expression-cxx11.cpp
Lines 2015 to 2016 in 52dd4b9
| constexpr int &n = n; // expected-error {{constant expression}} cxx23-note {{reference to 'n' is not a constant expression}} cxx23-note {{address of non-static constexpr variable 'n' may differ}} expected-warning {{not yet bound to a value}} | |
| // cxx11_20-note@-1 {{use of reference outside its lifetime is not allowed in a constant expression}} |
This looks strange. The old message looks better (see also CWG453) and the new one is possibly misleading as we perhaps shouldn't say the address of a reference variable.
Originally posted by @frederick-vs-ja in #95474 (comment)
This is still reproducible on the trunk. Godbolt link.
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconstexprAnything related to constant evaluationAnything related to constant evaluation