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
610610 of template classes. Fixes
611611 (`#68543 <https://github.com/llvm/llvm-project/issues/68543 >`_,
612612 `#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 >`_)
614615- Fixed an issue when a shift count larger than ``__INT64_MAX__ ``, in a right
615616 shift operation, could result in missing warnings about
616617 ``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(
61926192
61936193 // Instantiate a dynamic noexcept expression, if any.
61946194 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);
61956202 EnterExpressionEvaluationContext Unevaluated(
61966203 getSema(), Sema::ExpressionEvaluationContext::ConstantEvaluated);
61976204 ExprResult NoexceptExpr = getDerived().TransformExpr(ESI.NoexceptExpr);
Original file line number Diff line number Diff line change @@ -64,6 +64,21 @@ namespace DependentDefaultCtorExceptionSpec {
6464 struct A { multimap<int > Map; } a;
6565
6666 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}}
6782}
6883
6984#endif
You can’t perform that action at this time.
0 commit comments