[all-commits] [llvm/llvm-project] 1c55f0: Properly diagnose constant evaluation issues at TU...
Aaron Ballman via All-commits
all-commits at lists.llvm.org
Tue Mar 8 07:19:43 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 1c55f05c6a6b58f8cc7b15a37e79753fb8abe3e3
https://github.com/llvm/llvm-project/commit/1c55f05c6a6b58f8cc7b15a37e79753fb8abe3e3
Author: Aaron Ballman <aaron at aaronballman.com>
Date: 2022-03-08 (Tue, 08 Mar 2022)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/lib/Parse/ParseAST.cpp
M clang/lib/Sema/Sema.cpp
M clang/test/SemaCXX/cxx2a-consteval.cpp
Log Message:
-----------
Properly diagnose constant evaluation issues at TU scope
We were not creating an evaluation context for the TU scope, so we
never popped an evaluation context for it. Popping the evaluation
context triggers a number of diagnostics, including warnings about
immediate invocations that we were previously missing.
Note: I think we have an additional issue that we should solve, but not
as part of this patch. I don't think Clang is properly modeling static
initialization as happening before constant expression evaluation. I
think structure members members are zero initialized per
http://eel.is/c++draft/basic.start.static#1,
https://eel.is/c++draft/basic.start.static#2.sentence-2, and
http://eel.is/c++draft/dcl.init#general-6.2 and the new test case
actually should be accepted. However, it's also worth noting that other
compilers behave the way this patch makes Clang behave:
https://godbolt.org/z/T7noqhdPr
More information about the All-commits
mailing list