File tree Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -769,6 +769,8 @@ Bug Fixes to C++ Support
769
769
- Fixed a crash when trying to emit captures in a lambda call operator with an explicit object
770
770
parameter that is called on a derived type of the lambda.
771
771
Fixes (#GH87210), (GH89541).
772
+ - Clang no longer tries to check if an expression is immediate-escalating in an unevaluated context.
773
+ Fixes (#GH91308).
772
774
773
775
Bug Fixes to AST Handling
774
776
^^^^^^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change @@ -5112,6 +5112,13 @@ class Sema final : public SemaBase {
5112
5112
Context == ExpressionEvaluationContext::UnevaluatedList;
5113
5113
}
5114
5114
5115
+ bool isPotentiallyEvaluated() const {
5116
+ return Context == ExpressionEvaluationContext::PotentiallyEvaluated ||
5117
+ Context ==
5118
+ ExpressionEvaluationContext::PotentiallyEvaluatedIfUsed ||
5119
+ Context == ExpressionEvaluationContext::ConstantEvaluated;
5120
+ }
5121
+
5115
5122
bool isConstantEvaluated() const {
5116
5123
return Context == ExpressionEvaluationContext::ConstantEvaluated ||
5117
5124
Context == ExpressionEvaluationContext::ImmediateFunctionContext;
@@ -5146,6 +5153,12 @@ class Sema final : public SemaBase {
5146
5153
return ExprEvalContexts.back();
5147
5154
};
5148
5155
5156
+ const ExpressionEvaluationContextRecord &parentEvaluationContext() const {
5157
+ assert(ExprEvalContexts.size() >= 2 &&
5158
+ "Must be in an expression evaluation context");
5159
+ return ExprEvalContexts[ExprEvalContexts.size() - 2];
5160
+ };
5161
+
5149
5162
bool isBoundsAttrContext() const {
5150
5163
return ExprEvalContexts.back().ExprContext ==
5151
5164
ExpressionEvaluationContextRecord::ExpressionKind::
Original file line number Diff line number Diff line change @@ -4788,8 +4788,13 @@ TemplateDeductionResult Sema::DeduceTemplateArguments(
4788
4788
DeduceReturnType (Specialization, Info.getLocation (), false ))
4789
4789
return TemplateDeductionResult::MiscellaneousDeductionFailure;
4790
4790
4791
+ // [C++26][expr.const]/p17
4792
+ // An expression or conversion is immediate-escalating if it is not initially
4793
+ // in an immediate function context and it is [...]
4794
+ // a potentially-evaluated id-expression that denotes an immediate function.
4791
4795
if (IsAddressOfFunction && getLangOpts ().CPlusPlus20 &&
4792
4796
Specialization->isImmediateEscalating () &&
4797
+ parentEvaluationContext ().isPotentiallyEvaluated () &&
4793
4798
CheckIfFunctionSpecializationIsImmediate (Specialization,
4794
4799
Info.getLocation ()))
4795
4800
return TemplateDeductionResult::MiscellaneousDeductionFailure;
Original file line number Diff line number Diff line change @@ -446,3 +446,11 @@ int h(int x) {
446
446
}
447
447
448
448
#endif
449
+
450
+
451
+ namespace GH91308 {
452
+ constexpr void f (auto ) {
453
+ static_assert (false );
454
+ }
455
+ using R1 = decltype (&f<int >);
456
+ }
You can’t perform that action at this time.
0 commit comments