File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -971,6 +971,7 @@ Bug Fixes to C++ Support
971971- Fixed canonicalization of pack indexing types - Clang did not always recognized identical pack indexing. (#GH123033)
972972- Fixed a nested lambda substitution issue for constraint evaluation. (#GH123441)
973973- Fixed various false diagnostics related to the use of immediate functions. (#GH123472)
974+ - Fix immediate escalation not propagating through inherited constructors. (#GH112677)
974975
975976Bug Fixes to AST Handling
976977^^^^^^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change @@ -3283,6 +3283,13 @@ bool FunctionDecl::isImmediateEscalating() const {
32833283 // consteval specifier,
32843284 if (isDefaulted () && !isConsteval ())
32853285 return true ;
3286+
3287+ if (auto *CD = dyn_cast<CXXConstructorDecl>(this );
3288+ CD && CD->isInheritingConstructor ())
3289+ return CD->getInheritedConstructor ()
3290+ .getConstructor ()
3291+ ->isImmediateEscalating ();
3292+
32863293 // - a function that results from the instantiation of a templated entity
32873294 // defined with the constexpr specifier.
32883295 TemplatedKind TK = getTemplatedKind ();
@@ -3303,6 +3310,12 @@ bool FunctionDecl::isImmediateFunction() const {
33033310 if (isImmediateEscalating () && BodyContainsImmediateEscalatingExpressions ())
33043311 return true ;
33053312
3313+ if (auto *CD = dyn_cast<CXXConstructorDecl>(this );
3314+ CD && CD->isInheritingConstructor ())
3315+ return CD->getInheritedConstructor ()
3316+ .getConstructor ()
3317+ ->isImmediateFunction ();
3318+
33063319 if (const auto *MD = dyn_cast<CXXMethodDecl>(this );
33073320 MD && MD->isLambdaStaticInvoker ())
33083321 return MD->getParent ()->getLambdaCallOperator ()->isImmediateFunction ();
Original file line number Diff line number Diff line change @@ -496,3 +496,24 @@ struct Y {
496496template void g<Y>();
497497
498498}
499+
500+ namespace GH112677 {
501+
502+ class ConstEval {
503+ public:
504+ consteval ConstEval (int ); // expected-note {{declared here}}
505+ };
506+
507+ struct B {
508+ ConstEval val;
509+ template <class Anything = int > constexpr
510+ B (int arg) : val(arg) {} // expected-note {{undefined constructor 'ConstEval'}}
511+ };
512+ struct C : B {
513+ using B::B; // expected-note {{in call to 'B<int>(0)'}}
514+ };
515+
516+ C c (0 ); // expected-note{{in implicit initialization for inherited constructor of 'C'}}
517+ // expected-error@-1 {{call to immediate function 'GH112677::C::B' is not a constant expression}}
518+
519+ }
You can’t perform that action at this time.
0 commit comments