[all-commits] [llvm/llvm-project] 021443: [clang] fix constexpr-unknown handling of self-ref...
Eli Friedman via All-commits
all-commits at lists.llvm.org
Mon May 19 11:28:13 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 021443cd2a8127ab0432c5e48f9dbba30d9bc6ce
https://github.com/llvm/llvm-project/commit/021443cd2a8127ab0432c5e48f9dbba30d9bc6ce
Author: Eli Friedman <efriedma at quicinc.com>
Date: 2025-05-19 (Mon, 19 May 2025)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/lib/AST/ExprConstant.cpp
M clang/test/SemaCXX/constant-expression-p2280r4.cpp
Log Message:
-----------
[clang] fix constexpr-unknown handling of self-references. (#132990)
Usually, in constant evaluation, references which are local to the
evaluation have to be initialized before they're accessed. However,
there's one funny special case: the initializer of a reference can refer
to itself. This generally ends up being undefined behavior if it's used
in an evaluated context, but it isn't otherwise forbidden.
In constant evaluation, this splits into two cases: global variables,
and local variables in constexpr functions. This patch handles both of
those cases. (Local variables tends to trip other errors in most cases,
but if you try hard enough, you can get an accepts-invalid.)
Fixes #131330 .
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list