File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -610,7 +610,8 @@ Bug Fixes in This Version
610
610
of template classes. Fixes
611
611
(`#68543 <https://github.com/llvm/llvm-project/issues/68543 >`_,
612
612
`#42496 <https://github.com/llvm/llvm-project/issues/42496 >`_,
613
- `#77071 <https://github.com/llvm/llvm-project/issues/77071 >`_)
613
+ `#77071 <https://github.com/llvm/llvm-project/issues/77071 >`_,
614
+ `#77411 <https://github.com/llvm/llvm-project/issues/77411 >`_)
614
615
- Fixed an issue when a shift count larger than ``__INT64_MAX__ ``, in a right
615
616
shift operation, could result in missing warnings about
616
617
``shift count >= width of type `` or internal compiler error.
Original file line number Diff line number Diff line change @@ -6192,6 +6192,13 @@ bool TreeTransform<Derived>::TransformExceptionSpec(
6192
6192
6193
6193
// Instantiate a dynamic noexcept expression, if any.
6194
6194
if (isComputedNoexcept(ESI.Type)) {
6195
+ // Update this scrope because ContextDecl in Sema will be used in
6196
+ // TransformExpr.
6197
+ auto *Method = dyn_cast_if_present<CXXMethodDecl>(ESI.SourceTemplate);
6198
+ Sema::CXXThisScopeRAII ThisScope(
6199
+ SemaRef, Method ? Method->getParent() : nullptr,
6200
+ Method ? Method->getMethodQualifiers() : Qualifiers{},
6201
+ Method != nullptr);
6195
6202
EnterExpressionEvaluationContext Unevaluated(
6196
6203
getSema(), Sema::ExpressionEvaluationContext::ConstantEvaluated);
6197
6204
ExprResult NoexceptExpr = getDerived().TransformExpr(ESI.NoexceptExpr);
Original file line number Diff line number Diff line change @@ -64,6 +64,21 @@ namespace DependentDefaultCtorExceptionSpec {
64
64
struct A { multimap<int > Map; } a;
65
65
66
66
static_assert (noexcept (A()));
67
+
68
+ template <class > struct NoexceptWithThis {
69
+ int ca;
70
+ template <class T > auto foo (T) noexcept (ca) { return true ; }
71
+ // expected-error@-1 {{noexcept specifier argument is not a constant expression}}
72
+ // expected-note@-2 {{in instantiation of exception specification}}
73
+ // expected-note@-3 {{implicit use of 'this' pointer is only allowed within the evaluation of a call to a 'constexpr' member function}}
74
+ };
75
+ struct InstantiateFromAnotherClass {
76
+ template <class B , class T = decltype (static_cast <bool (B::*)(int )>(&B::foo))> // expected-note {{in instantiation of function template specialization}}
77
+ InstantiateFromAnotherClass (B *) {} // expected-note {{in instantiation of default argument}}
78
+ };
79
+ NoexceptWithThis<int > f{};
80
+ // Don't crash here.
81
+ InstantiateFromAnotherClass b{&f}; // expected-note {{while substituting deduced template arguments into function template}}
67
82
}
68
83
69
84
#endif
You can’t perform that action at this time.
0 commit comments