Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -97,6 +97,12 @@ ----------------------------------- - Clang constexpr evaluator now prints template arguments when displaying template-specialization function calls. +- Clang now diagnoses wider cases of tautological use of consteval if or + ``std::is_constant_evaluated``. This also suppresses some false positives. + (`#43760: `_) + (`#51567: `_) +- Clang now diagnoses narrowing implicit conversions on variable initializers in immediate + function context and on constexpr variable template initializers. Bug Fixes in This Version ------------------------- Index: clang/include/clang/Basic/DiagnosticASTKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticASTKinds.td +++ clang/include/clang/Basic/DiagnosticASTKinds.td @@ -411,10 +411,6 @@ def note_unimplemented_constexpr_lambda_feature_ast : Note< "unimplemented constexpr lambda feature: %0 (coming soon!)">; -def warn_is_constant_evaluated_always_true_constexpr : Warning< - "'%0' will always evaluate to 'true' in a manifestly constant-evaluated expression">, - InGroup>; - // inline asm related. let CategoryName = "Inline Assembly Issue" in { def err_asm_invalid_escape : Error< Index: clang/include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticSemaKinds.td +++ clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -1564,8 +1564,8 @@ "the message in a static assertion must be produced by a " "constant expression">; -def warn_consteval_if_always_true : Warning< - "consteval if is always true in an %select{unevaluated|immediate}0 context">, +def warn_tautological_consteval_if : Warning< + "consteval if is always %select{true|false}0 in this context">, InGroup>; def ext_inline_variable : ExtWarn< @@ -8846,6 +8846,9 @@ def warn_side_effects_typeid : Warning< "expression with side effects will be evaluated despite being used as an " "operand to 'typeid'">, InGroup; +def warn_tautological_is_constant_evaluated : Warning< + "'%select{std::is_constant_evaluated|__builtin_is_constant_evaluated}0' will always evaluate to %select{false|true}1 in this context">, + InGroup>; def warn_unused_result : Warning< "ignoring return value of function declared with %0 attribute">, InGroup; Index: clang/include/clang/Sema/Sema.h =================================================================== --- clang/include/clang/Sema/Sema.h +++ clang/include/clang/Sema/Sema.h @@ -1350,6 +1350,9 @@ bool InDiscardedStatement; bool InImmediateFunctionContext; bool InImmediateEscalatingFunctionContext; + // The immediate occurances of consteval if or std::is_constant_evaluated() + // are tautologically false + bool IsRuntimeEvaluated; bool IsCurrentlyCheckingDefaultArgumentOrInitializer = false; @@ -1379,7 +1382,8 @@ NumCleanupObjects(NumCleanupObjects), NumTypos(0), ManglingContextDecl(ManglingContextDecl), ExprContext(ExprContext), InDiscardedStatement(false), InImmediateFunctionContext(false), - InImmediateEscalatingFunctionContext(false) {} + InImmediateEscalatingFunctionContext(false), + IsRuntimeEvaluated(false) {} bool isUnevaluated() const { return Context == ExpressionEvaluationContext::Unevaluated || Index: clang/lib/AST/ExprConstant.cpp =================================================================== --- clang/lib/AST/ExprConstant.cpp +++ clang/lib/AST/ExprConstant.cpp @@ -12141,21 +12141,6 @@ } case Builtin::BI__builtin_is_constant_evaluated: { - const auto *Callee = Info.CurrentCall->getCallee(); - if (Info.InConstantContext && !Info.CheckingPotentialConstantExpression && - (Info.CallStackDepth == 1 || - (Info.CallStackDepth == 2 && Callee->isInStdNamespace() && - Callee->getIdentifier() && - Callee->getIdentifier()->isStr("is_constant_evaluated")))) { - // FIXME: Find a better way to avoid duplicated diagnostics. - if (Info.EvalStatus.Diag) - Info.report((Info.CallStackDepth == 1) ? E->getExprLoc() - : Info.CurrentCall->CallLoc, - diag::warn_is_constant_evaluated_always_true_constexpr) - << (Info.CallStackDepth == 1 ? "__builtin_is_constant_evaluated" - : "std::is_constant_evaluated"); - } - return Success(Info.InConstantContext, E); } Index: clang/lib/Parse/ParseDecl.cpp =================================================================== --- clang/lib/Parse/ParseDecl.cpp +++ clang/lib/Parse/ParseDecl.cpp @@ -2384,6 +2384,15 @@ return ParseDeclarationAfterDeclaratorAndAttributes(D, TemplateInfo); } +/// Determine whether the given declaration is a global variable or +/// static data member. +static bool isNonlocalVariable(const Decl *D) { + if (const VarDecl *Var = dyn_cast_or_null(D)) + return Var->hasGlobalStorage(); + + return false; +} + Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes( Declarator &D, const ParsedTemplateInfo &TemplateInfo, ForRangeInit *FRI) { // RAII type used to track whether we're inside an initializer. @@ -2416,6 +2425,36 @@ ThisDecl = nullptr; } }; + struct EnterInitializerExpressionEvaluationContext { + Sema &S; + bool Entered; + + EnterInitializerExpressionEvaluationContext(Sema &S, Declarator &D, + Decl *ThisDecl) + : S(S), Entered(false) { + if (ThisDecl && S.getLangOpts().CPlusPlus && !ThisDecl->isInvalidDecl()) { + Entered = true; + bool RuntimeEvaluated = S.ExprEvalContexts.back().IsRuntimeEvaluated; + Sema::ExpressionEvaluationContext NewEEC = + S.ExprEvalContexts.back().Context; + if ((D.getDeclSpec().getTypeQualifiers() == DeclSpec::TQ_const || + isNonlocalVariable(ThisDecl)) && + S.ExprEvalContexts.back().IsRuntimeEvaluated) { + RuntimeEvaluated = false; + } + if (D.getDeclSpec().hasConstexprSpecifier()) { + NewEEC = Sema::ExpressionEvaluationContext::ConstantEvaluated; + RuntimeEvaluated = false; + } + S.PushExpressionEvaluationContext(NewEEC, ThisDecl); + S.ExprEvalContexts.back().IsRuntimeEvaluated = RuntimeEvaluated; + } + } + ~EnterInitializerExpressionEvaluationContext() { + if (Entered) + S.PopExpressionEvaluationContext(); + } + }; enum class InitKind { Uninitialized, Equal, CXXDirect, CXXBraced }; InitKind TheInitKind; @@ -2514,6 +2553,7 @@ << getLangOpts().CPlusPlus20; } else { InitializerScopeRAII InitScope(*this, D, ThisDecl); + EnterInitializerExpressionEvaluationContext InitEC(Actions, D, ThisDecl); if (Tok.is(tok::code_completion)) { cutOffParsing(); @@ -2561,6 +2601,7 @@ ExprVector Exprs; InitializerScopeRAII InitScope(*this, D, ThisDecl); + EnterInitializerExpressionEvaluationContext InitEC(Actions, D, ThisDecl); auto ThisVarDecl = dyn_cast_or_null(ThisDecl); auto RunSignatureHelp = [&]() { @@ -2611,6 +2652,7 @@ Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists); InitializerScopeRAII InitScope(*this, D, ThisDecl); + EnterInitializerExpressionEvaluationContext InitEC(Actions, D, ThisDecl); PreferredType.enterVariableInit(Tok.getLocation(), ThisDecl); ExprResult Init(ParseBraceInitializer()); Index: clang/lib/Parse/ParseDeclCXX.cpp =================================================================== --- clang/lib/Parse/ParseDeclCXX.cpp +++ clang/lib/Parse/ParseDeclCXX.cpp @@ -3212,9 +3212,14 @@ assert(Tok.isOneOf(tok::equal, tok::l_brace) && "Data member initializer not starting with '=' or '{'"); + bool IsConstexpr = false; + if (const auto *VD = dyn_cast_if_present(D)) + IsConstexpr = VD->isConstexpr(); + EnterExpressionEvaluationContext Context( Actions, - isa_and_present(D) + IsConstexpr ? Sema::ExpressionEvaluationContext::ConstantEvaluated + : isa_and_present(D) ? Sema::ExpressionEvaluationContext::PotentiallyEvaluatedIfUsed : Sema::ExpressionEvaluationContext::PotentiallyEvaluated, D); Index: clang/lib/Parse/ParseStmt.cpp =================================================================== --- clang/lib/Parse/ParseStmt.cpp +++ clang/lib/Parse/ParseStmt.cpp @@ -1510,6 +1510,11 @@ SourceLocation RParen; std::optional ConstexprCondition; if (!IsConsteval) { + EnterExpressionEvaluationContext Consteval( + Actions, Sema::ExpressionEvaluationContext::ConstantEvaluated, + /*LambdaContextDecl=*/nullptr, + Sema::ExpressionEvaluationContextRecord::EK_Other, + /*ShouldEnter=*/IsConstexpr); if (ParseParenExprOrCondition(&InitStmt, Cond, IfLoc, IsConstexpr ? Sema::ConditionKind::ConstexprIf @@ -1557,11 +1562,16 @@ if (NotLocation.isInvalid() && IsConsteval) { Context = Sema::ExpressionEvaluationContext::ImmediateFunctionContext; ShouldEnter = true; + } else if (NotLocation.isValid() && IsConsteval) { + Context = Actions.ExprEvalContexts.back().Context; + ShouldEnter = true; } EnterExpressionEvaluationContext PotentiallyDiscarded( Actions, Context, nullptr, Sema::ExpressionEvaluationContextRecord::EK_Other, ShouldEnter); + if (NotLocation.isValid() && IsConsteval) + Actions.ExprEvalContexts.back().IsRuntimeEvaluated = true; ThenStmt = ParseStatement(&InnerStatementTrailingElseLoc); } @@ -1602,11 +1612,16 @@ if (NotLocation.isValid() && IsConsteval) { Context = Sema::ExpressionEvaluationContext::ImmediateFunctionContext; ShouldEnter = true; + } else if (NotLocation.isInvalid() && IsConsteval) { + Context = Actions.ExprEvalContexts.back().Context; + ShouldEnter = true; } EnterExpressionEvaluationContext PotentiallyDiscarded( Actions, Context, nullptr, Sema::ExpressionEvaluationContextRecord::EK_Other, ShouldEnter); + if (NotLocation.isInvalid() && IsConsteval) + Actions.ExprEvalContexts.back().IsRuntimeEvaluated = true; ElseStmt = ParseStatement(); if (ElseStmt.isUsable()) Index: clang/lib/Sema/SemaChecking.cpp =================================================================== --- clang/lib/Sema/SemaChecking.cpp +++ clang/lib/Sema/SemaChecking.cpp @@ -14649,7 +14649,8 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T, SourceLocation CC, bool *ICContext = nullptr, - bool IsListInit = false) { + bool IsListInit = false, + bool IsConstexprInit = false) { if (E->isTypeDependent() || E->isValueDependent()) return; const Type *Source = S.Context.getCanonicalType(E->getType()).getTypePtr(); @@ -14958,11 +14959,14 @@ SmallString<32> PrettyTargetValue; TargetFloatValue.toString(PrettyTargetValue, TargetPrecision); - S.DiagRuntimeBehavior( - E->getExprLoc(), E, + PartialDiagnostic PD = S.PDiag(diag::warn_impcast_integer_float_precision_constant) - << PrettySourceValue << PrettyTargetValue << E->getType() << T - << E->getSourceRange() << clang::SourceRange(CC)); + << PrettySourceValue << PrettyTargetValue << E->getType() << T + << E->getSourceRange() << clang::SourceRange(CC); + if (IsConstexprInit) + S.Diag(E->getExprLoc(), PD); + else + S.DiagRuntimeBehavior(E->getExprLoc(), E, PD); } } else { // Otherwise, the implicit conversion may lose precision. @@ -15016,11 +15020,14 @@ std::string PrettySourceValue = toString(Value, 10); std::string PrettyTargetValue = PrettyPrintInRange(Value, TargetRange); - S.DiagRuntimeBehavior( - E->getExprLoc(), E, + PartialDiagnostic PD = S.PDiag(diag::warn_impcast_integer_precision_constant) - << PrettySourceValue << PrettyTargetValue << E->getType() << T - << E->getSourceRange() << SourceRange(CC)); + << PrettySourceValue << PrettyTargetValue << E->getType() << T + << E->getSourceRange() << SourceRange(CC); + if (IsConstexprInit) + S.Diag(E->getExprLoc(), PD); + else + S.DiagRuntimeBehavior(E->getExprLoc(), E, PD); return; } @@ -15062,11 +15069,14 @@ std::string PrettySourceValue = toString(Value, 10); std::string PrettyTargetValue = PrettyPrintInRange(Value, TargetRange); - S.DiagRuntimeBehavior( - E->getExprLoc(), E, + PartialDiagnostic PD = S.PDiag(diag::warn_impcast_integer_precision_constant) - << PrettySourceValue << PrettyTargetValue << E->getType() << T - << E->getSourceRange() << SourceRange(CC)); + << PrettySourceValue << PrettyTargetValue << E->getType() << T + << E->getSourceRange() << SourceRange(CC); + if (IsConstexprInit) + S.Diag(E->getExprLoc(), PD); + else + S.DiagRuntimeBehavior(E->getExprLoc(), E, PD); return; } } @@ -15228,6 +15238,17 @@ if (auto *Src = OVE->getSourceExpr()) SourceExpr = Src; + bool IsConstexprInit = + S.isConstantEvaluated() && + isa_and_present(S.ExprEvalContexts.back().ManglingContextDecl); + // Constant-evaluated initializers are not diagnosed by DiagRuntimeBehavior, + // but narrowings from the evaluated result to the variable type should be + // diagnosed. + if (IsConstexprInit && SourceExpr->getType() != T) { + CheckImplicitConversion(S, SourceExpr, T, CC, nullptr, IsListInit, + /*IsConstexprInit=*/true); + } + if (const auto *UO = dyn_cast(SourceExpr)) if (UO->getOpcode() == UO_Not && UO->getSubExpr()->isKnownToHaveBooleanValue()) @@ -15263,7 +15284,7 @@ // Go ahead and check any implicit conversions we might have skipped. // The non-canonical typecheck is just an optimization; // CheckImplicitConversion will filter out dead implicit conversions. - if (SourceExpr->getType() != T) + if (!IsConstexprInit && SourceExpr->getType() != T) CheckImplicitConversion(S, SourceExpr, T, CC, nullptr, IsListInit); // Now continue drilling into this expression. Index: clang/lib/Sema/SemaDecl.cpp =================================================================== --- clang/lib/Sema/SemaDecl.cpp +++ clang/lib/Sema/SemaDecl.cpp @@ -15238,7 +15238,7 @@ // Do not push if it is a lambda because one is already pushed when building // the lambda in ActOnStartOfLambdaDefinition(). - if (!isLambdaCallOperator(FD)) + if (!isLambdaCallOperator(FD)) { // [expr.const]/p14.1 // An expression or conversion is in an immediate function context if it is // potentially evaluated and either: its innermost enclosing non-block scope @@ -15246,6 +15246,9 @@ PushExpressionEvaluationContext( FD->isConsteval() ? ExpressionEvaluationContext::ImmediateFunctionContext : ExprEvalContexts.back().Context); + if (!FD->isConsteval() && !FD->isConstexpr()) + ExprEvalContexts.back().IsRuntimeEvaluated = true; + } // Each ExpressionEvaluationContextRecord also keeps track of whether the // context is nested in an immediate function context, so smaller contexts Index: clang/lib/Sema/SemaDeclCXX.cpp =================================================================== --- clang/lib/Sema/SemaDeclCXX.cpp +++ clang/lib/Sema/SemaDeclCXX.cpp @@ -18151,15 +18151,6 @@ Diag(D->getLocation(), diag::err_illegal_initializer); } -/// Determine whether the given declaration is a global variable or -/// static data member. -static bool isNonlocalVariable(const Decl *D) { - if (const VarDecl *Var = dyn_cast_or_null(D)) - return Var->hasGlobalStorage(); - - return false; -} - /// Invoked when we are about to parse an initializer for the declaration /// 'Dcl'. /// @@ -18182,9 +18173,6 @@ // If we are parsing the initializer for a static data member, push a // new expression evaluation context that is associated with this static // data member. - if (isNonlocalVariable(D)) - PushExpressionEvaluationContext( - ExpressionEvaluationContext::PotentiallyEvaluated, D); } /// Invoked after we are finished parsing an initializer for the declaration D. @@ -18193,9 +18181,6 @@ if (!D || D->isInvalidDecl()) return; - if (isNonlocalVariable(D)) - PopExpressionEvaluationContext(); - if (S && D->isOutOfLine()) ExitDeclaratorContext(S); } Index: clang/lib/Sema/SemaExpr.cpp =================================================================== --- clang/lib/Sema/SemaExpr.cpp +++ clang/lib/Sema/SemaExpr.cpp @@ -7024,6 +7024,30 @@ << FixItHint::CreateInsertion(DRE->getLocation(), "std::"); } +// Diagnose uses of std::is_constant_evaluated or +// __builtin_is_constant_evaluated in contexts where the result is known at +// compile time. +static void DiagnoseTautologicalCallToIsConstantEvaluated(Sema &S, + CallExpr *CE) { + if (S.inTemplateInstantiation()) + return; + if (const FunctionDecl *FD = CE->getDirectCallee()) { + bool IsBuiltin = + FD->getBuiltinID() == Builtin::BI__builtin_is_constant_evaluated; + + if ((FD->isInStdNamespace() && + FD->getNameAsString() == "is_constant_evaluated") || + IsBuiltin) { + bool AlwaysTrue = S.ExprEvalContexts.back().isConstantEvaluated() || + S.ExprEvalContexts.back().isUnevaluated(); + bool AlwaysFalse = S.ExprEvalContexts.back().IsRuntimeEvaluated; + if (AlwaysTrue || AlwaysFalse) + S.Diag(CE->getBeginLoc(), diag::warn_tautological_is_constant_evaluated) + << IsBuiltin << AlwaysTrue; + } + } +} + ExprResult Sema::ActOnCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig) { @@ -7050,8 +7074,10 @@ ExecConfig); if (LangOpts.CPlusPlus) { CallExpr *CE = dyn_cast(Call.get()); - if (CE) + if (CE) { DiagnosedUnqualifiedCallsToStdFunctions(*this, CE); + DiagnoseTautologicalCallToIsConstantEvaluated(*this, CE); + } } return Call; } @@ -18508,6 +18534,8 @@ } else llvm_unreachable("Couldn't infer lambda error message."); + if (auto *VD = dyn_cast_if_present(Rec.ManglingContextDecl)) + VD->setInvalidDecl(); for (const auto *L : Rec.Lambdas) Diag(L->getBeginLoc(), D); } Index: clang/lib/Sema/SemaLambda.cpp =================================================================== --- clang/lib/Sema/SemaLambda.cpp +++ clang/lib/Sema/SemaLambda.cpp @@ -1420,6 +1420,8 @@ PushExpressionEvaluationContext( LSI->CallOperator->isConsteval() ? ExpressionEvaluationContext::ImmediateFunctionContext + : isConstantEvaluated() + ? ExpressionEvaluationContext::ConstantEvaluated : ExpressionEvaluationContext::PotentiallyEvaluated); ExprEvalContexts.back().InImmediateFunctionContext = LSI->CallOperator->isConsteval(); Index: clang/lib/Sema/SemaStmt.cpp =================================================================== --- clang/lib/Sema/SemaStmt.cpp +++ clang/lib/Sema/SemaStmt.cpp @@ -933,16 +933,14 @@ } if (ConstevalOrNegatedConsteval) { - bool Immediate = ExprEvalContexts.back().Context == - ExpressionEvaluationContext::ImmediateFunctionContext; - if (CurContext->isFunctionOrMethod()) { - const auto *FD = - dyn_cast(Decl::castFromDeclContext(CurContext)); - if (FD && FD->isImmediateFunction()) - Immediate = true; - } - if (isUnevaluatedContext() || Immediate) - Diags.Report(IfLoc, diag::warn_consteval_if_always_true) << Immediate; + bool AlwaysTrue = ExprEvalContexts.back().isConstantEvaluated() || + ExprEvalContexts.back().isUnevaluated(); + bool AlwaysFalse = ExprEvalContexts.back().IsRuntimeEvaluated; + if (AlwaysTrue || AlwaysFalse) + Diags.Report(IfLoc, diag::warn_tautological_consteval_if) + << (AlwaysTrue + ? StatementKind == IfStatementKind::ConstevalNegated + : StatementKind == IfStatementKind::ConstevalNonNegated); } return BuildIfStmt(IfLoc, StatementKind, LParenLoc, InitStmt, Cond, RParenLoc, Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp =================================================================== --- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -5372,8 +5372,11 @@ Var->setImplicitlyInline(); if (OldVar->getInit()) { - EnterExpressionEvaluationContext Evaluated( - *this, Sema::ExpressionEvaluationContext::PotentiallyEvaluated, Var); + Sema::ExpressionEvaluationContext InitEvalContext = + Var->isConstexpr() + ? Sema::ExpressionEvaluationContext::ConstantEvaluated + : Sema::ExpressionEvaluationContext::PotentiallyEvaluated; + EnterExpressionEvaluationContext Evaluated(*this, InitEvalContext, Var); // Instantiate the initializer. ExprResult Init; Index: clang/test/AST/Interp/builtins.cpp =================================================================== --- clang/test/AST/Interp/builtins.cpp +++ clang/test/AST/Interp/builtins.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter %s -verify -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter %s -Wno-constant-evaluated -verify +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter %s -Wno-constant-evaluated -S -emit-llvm -o - | FileCheck %s // RUN: %clang_cc1 -verify=ref %s -Wno-constant-evaluated // RUN: %clang_cc1 -verify=ref %s -Wno-constant-evaluated %s -S -emit-llvm -o - | FileCheck %s Index: clang/test/AST/Interp/if.cpp =================================================================== --- clang/test/AST/Interp/if.cpp +++ clang/test/AST/Interp/if.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -std=c++23 -fsyntax-only -fexperimental-new-constant-interpreter %s -verify -// RUN: %clang_cc1 -std=c++23 -fsyntax-only %s -verify=ref +// RUN: %clang_cc1 -std=c++23 -fsyntax-only -fexperimental-new-constant-interpreter -Wno-redundant-consteval-if %s -verify +// RUN: %clang_cc1 -std=c++23 -fsyntax-only -Wno-redundant-consteval-if %s -verify=ref // expected-no-diagnostics // ref-no-diagnostics Index: clang/test/AST/Interp/literals.cpp =================================================================== --- clang/test/AST/Interp/literals.cpp +++ clang/test/AST/Interp/literals.cpp @@ -197,15 +197,11 @@ #if __cplusplus >= 202002L /// FIXME: The following code should be accepted. consteval int foo(int n) { // ref-error {{consteval function never produces a constant expression}} - return sizeof(int[n]); // ref-note 3{{not valid in a constant expression}} \ - // expected-note {{not valid in a constant expression}} + return sizeof(int[n]); // ref-note 2 {{not valid in a constant expression}} } - constinit int var = foo(5); // ref-error {{not a constant expression}} \ - // ref-note 2{{in call to}} \ + constinit int var = foo(5); // ref-note {{in call to}} \ // ref-error {{does not have a constant initializer}} \ // ref-note {{required by 'constinit' specifier}} \ - // expected-error {{is not a constant expression}} \ - // expected-note {{in call to}} \ // expected-error {{does not have a constant initializer}} \ // expected-note {{required by 'constinit' specifier}} \ Index: clang/test/CXX/expr/expr.const/p2-0x.cpp =================================================================== --- clang/test/CXX/expr/expr.const/p2-0x.cpp +++ clang/test/CXX/expr/expr.const/p2-0x.cpp @@ -244,8 +244,8 @@ constexpr int n13 = n5 + n5; // expected-error {{constant expression}} expected-note {{value -4294967296 is outside the range of }} constexpr int n14 = n3 - n5; // expected-error {{constant expression}} expected-note {{value 4294967295 is outside the range of }} constexpr int n15 = n5 * n5; // expected-error {{constant expression}} expected-note {{value 4611686018427387904 is outside the range of }} - constexpr signed char c1 = 100 * 2; // ok expected-warning{{changes value}} - constexpr signed char c2 = '\x64' * '\2'; // also ok expected-warning{{changes value}} + constexpr signed char c1 = 100 * 2; // ok expected-warning {{changes value from 200 to -56}} + constexpr signed char c2 = '\x64' * '\2'; // also ok expected-warning {{changes value from 200 to -56}} constexpr long long ll1 = 0x7fffffffffffffff; // ok constexpr long long ll2 = ll1 + 1; // expected-error {{constant}} expected-note {{ 9223372036854775808 }} constexpr long long ll3 = -ll1 - 1; // ok Index: clang/test/CXX/expr/expr.const/p6-2a.cpp =================================================================== --- clang/test/CXX/expr/expr.const/p6-2a.cpp +++ clang/test/CXX/expr/expr.const/p6-2a.cpp @@ -43,12 +43,11 @@ constexpr Temporary t = {3}; // expected-error {{must have constant destruction}} expected-note {{created here}} expected-note {{in call}} namespace P1073R3 { -consteval int f() { return 42; } // expected-note 2 {{declared here}} +consteval int f() { return 42; } // expected-note {{declared here}} consteval auto g() { return f; } consteval int h(int (*p)() = g()) { return p(); } constexpr int r = h(); -constexpr auto e = g(); // expected-error {{call to consteval function 'P1073R3::g' is not a constant expression}} \ - expected-error {{constexpr variable 'e' must be initialized by a constant expression}} \ - expected-note 2 {{pointer to a consteval declaration is not a constant expression}} +constexpr auto e = g(); // expected-error {{constexpr variable 'e' must be initialized by a constant expression}} \ + expected-note {{pointer to a consteval declaration is not a constant expression}} static_assert(r == 42); } // namespace P1073R3 Index: clang/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp =================================================================== --- clang/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp +++ clang/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp @@ -16,4 +16,5 @@ #if __cplusplus < 201703L // expected-error@-2 {{constexpr variable cannot have non-literal type}} // expected-note@-3 {{lambda closure types are non-literal types before C++17}} +// expected-error@-4 {{a lambda expression may not appear inside of a constant expression}} #endif Index: clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p4.cpp =================================================================== --- clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p4.cpp +++ clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p4.cpp @@ -8,14 +8,14 @@ } else (void)0; // expected-error {{expected { after else}} static_assert([] { - if consteval { + if consteval { // expected-warning {{consteval if is always true}} return 0; } return 1; }() == 0); static_assert([] { - if consteval { + if consteval { // expected-warning {{consteval if is always true}} return 0; } else { return 1; @@ -23,7 +23,7 @@ }() == 0); static_assert([] { - if !consteval { + if !consteval { // expected-warning {{consteval if is always false}} return 0; } else { return 1; @@ -31,14 +31,15 @@ }() == 1); static_assert([] { - if not consteval { + if not consteval { // expected-warning {{consteval if is always false}} return 0; } return 1; }() == 1); if consteval [[likely]] { // expected-warning {{attribute 'likely' has no effect when annotating an 'if consteval' statement}}\ - // expected-note 2{{annotating the 'if consteval' statement here}} + // expected-note 2{{annotating the 'if consteval' statement here}} \ + // expected-warning {{consteval if is always false}} } @@ -49,7 +50,8 @@ } void test_consteval_jumps() { - if consteval { // expected-note 4{{jump enters controlled statement of consteval if}} + if consteval { // expected-warning {{consteval if is always false}} \ + // expected-note 4{{jump enters controlled statement of consteval if}} goto a; goto b; // expected-error {{cannot jump from this goto statement to its label}} a:; @@ -65,14 +67,16 @@ void test_consteval_switch() { int x = 42; switch (x) { - if consteval { // expected-note 2{{jump enters controlled statement of consteval if}} + if consteval { // expected-warning {{consteval if is always false}} \ + // expected-note 2{{jump enters controlled statement of consteval if}} case 1:; // expected-error {{cannot jump from switch statement to this case label}} default:; // expected-error {{cannot jump from switch statement to this case label}} } else { } } switch (x) { - if consteval { // expected-note 2{{jump enters controlled statement of consteval if}} + if consteval { // expected-warning {{consteval if is always false}} \ + // expected-note 2{{jump enters controlled statement of consteval if}} } else { case 2:; // expected-error {{cannot jump from switch statement to this case label}} default:; // expected-error {{cannot jump from switch statement to this case label}} @@ -99,32 +103,32 @@ } consteval void warn_in_consteval() { - if consteval { // expected-warning {{consteval if is always true in an immediate context}} - if consteval {} // expected-warning {{consteval if is always true in an immediate context}} + if consteval { // expected-warning {{consteval if is always true in this context}} + if consteval {} // expected-warning {{consteval if is always true in this context}} } } constexpr void warn_in_consteval2() { if consteval { - if consteval {} // expected-warning {{consteval if is always true in an immediate context}} + if consteval {} // expected-warning {{consteval if is always true in this context}} } } auto y = []() consteval { - if consteval { // expected-warning {{consteval if is always true in an immediate context}} - if consteval {} // expected-warning {{consteval if is always true in an immediate context}} + if consteval { // expected-warning {{consteval if is always true in this context}} + if consteval {} // expected-warning {{consteval if is always true in this context}} } }; namespace test_transform { int f(auto n) { - if consteval { + if consteval { // expected-warning {{consteval if is always false}} n.foo; //expected-error {{no member named}} } else { } - if !consteval { + if !consteval { // expected-warning {{consteval if is always true}} n.foo; //expected-error {{no member named}} } else { Index: clang/test/Parser/pragma-fenv_access.c =================================================================== --- clang/test/Parser/pragma-fenv_access.c +++ clang/test/Parser/pragma-fenv_access.c @@ -33,7 +33,7 @@ CONST float fnot_too_big = not_too_big; CONST int too_big = 0x7ffffff0; #if defined(CPP) -//expected-warning@+2{{implicit conversion}} +//expected-warning@+2{{implicit conversion from 'const int' to 'const float' changes value from 2147483632 to 2147483648}} #endif CONST float fbig = too_big; // inexact #if !defined(CPP) Index: clang/test/SemaCXX/constant-conversion.cpp =================================================================== --- clang/test/SemaCXX/constant-conversion.cpp +++ clang/test/SemaCXX/constant-conversion.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-apple-darwin %s +// RUN: %clang_cc1 -fsyntax-only -std=c++20 -verify -triple x86_64-apple-darwin %s // This file tests -Wconstant-conversion, a subcategory of -Wconversion // which is on by default. @@ -31,3 +31,59 @@ s.one_bit = 1; // expected-warning {{implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1}} s.one_bit = true; // no-warning } + +namespace Initializers { +constexpr char ok = true ? 0 : 200; +constexpr char a = 200; // expected-warning {{implicit conversion from 'int' to 'const char' changes value from 200 to -56}} +char b = 200; // expected-warning {{implicit conversion from 'int' to 'char' changes value from 200 to -56}} +const char c = 200; // expected-warning {{implicit conversion from 'int' to 'const char' changes value from 200 to -56}} + +void f() { + constexpr char a = 200; // expected-warning {{implicit conversion from 'int' to 'const char' changes value from 200 to -56}} + char b = 200; // expected-warning {{implicit conversion from 'int' to 'char' changes value from 200 to -56}} + const char c = 200; // expected-warning {{implicit conversion from 'int' to 'const char' changes value from 200 to -56}} + static char d = 2 * 100; // expected-warning {{implicit conversion from 'int' to 'char' changes value from 200 to -56}} +} + +constexpr void g() { + constexpr char a = 2 * 100; // expected-warning {{implicit conversion from 'int' to 'const char' changes value from 200 to -56}} + char b = 2 * 100; // expected-warning {{implicit conversion from 'int' to 'char' changes value from 200 to -56}} + const char c = 2 * 100; // expected-warning {{implicit conversion from 'int' to 'const char' changes value from 200 to -56}} +} + +consteval void h() { + char ok = true ? 0 : 200; + constexpr char a = 200; // expected-warning {{implicit conversion from 'int' to 'const char' changes value from 200 to -56}} + char b = 200; // expected-warning {{implicit conversion from 'int' to 'char' changes value from 200 to -56}} + const char c = 200; // expected-warning {{implicit conversion from 'int' to 'const char' changes value from 200 to -56}} +} + +template +int templ() { + constexpr char a = false ? 129 : N; // expected-warning {{implicit conversion from 'int' to 'const char' changes value from 200 to -56}} \ + // expected-warning {{implicit conversion from 'int' to 'const char' changes value from 345 to 89}} + return 3; +} + +void call_templ() { + int ok = templ<127>(); + int l = templ<3>(); + int m = templ<200>(); // expected-note {{in instantiation of}} + int n = templ<345>(); // expected-note {{in instantiation of}} +} + +template +constexpr signed char diff = a > b ? a - b : b - a; // expected-warning{{changes value from 201 to -55}} \ + // expected-warning{{changes value from 199 to -57}} \ + // expected-warning{{changes value from 299 to 43}} \ + // expected-warning{{changes value from 301 to 45}} + +void test_diff() { + char ok1 = diff<201, 100>; + char ok2 = diff<101, 200>; + char s1 = diff<301, 100>; // expected-note {{in instantiation of}} + char s2 = diff<101, 300>; // expected-note {{in instantiation of}} + char w1 = diff<101, 400>; // expected-note {{in instantiation of}} + char w2 = diff<401, 100>; // expected-note {{in instantiation of}} +} +} Index: clang/test/SemaCXX/constant-expression-cxx11.cpp =================================================================== --- clang/test/SemaCXX/constant-expression-cxx11.cpp +++ clang/test/SemaCXX/constant-expression-cxx11.cpp @@ -1961,7 +1961,7 @@ namespace Lifetime { void f() { - constexpr int &n = n; // expected-error {{constant expression}} expected-note {{use of reference outside its lifetime}} expected-warning {{not yet bound to a value}} + constexpr int &n = n; // expected-error {{constant expression}} expected-note {{use of reference outside its lifetime}} constexpr int m = m; // expected-error {{constant expression}} expected-note {{read of object outside its lifetime}} } Index: clang/test/SemaCXX/cxx2a-consteval.cpp =================================================================== --- clang/test/SemaCXX/cxx2a-consteval.cpp +++ clang/test/SemaCXX/cxx2a-consteval.cpp @@ -713,7 +713,7 @@ struct test { consteval int operator[](int i) const { return {}; } consteval const derp * operator->() const { return &d; } - consteval int f() const { return 12; } // expected-note 2{{declared here}} + consteval int f() const { return 12; } // expected-note {{declared here}} }; constexpr test a; @@ -726,8 +726,7 @@ constexpr int t = a[1]; constexpr int u = a.operator->()->b; constexpr int v = a->b; -// FIXME: I believe this case should work, but we currently reject. -constexpr int w = (a.*&test::f)(); // expected-error {{cannot take address of consteval function 'f' outside of an immediate invocation}} +constexpr int w = (a.*&test::f)(); constexpr int x = a.f(); // Show that we reject when not in an immediate context. @@ -1073,18 +1072,17 @@ consteval const char* make_name(const char* name) { return name;} consteval const char* pad(int P) { return "thestring"; } -int bad = 10; // expected-note 6{{declared here}} +int bad = 10; // expected-note 5{{declared here}} tester glob1(make_name("glob1")); tester glob2(make_name("glob2")); constexpr tester cglob(make_name("cglob")); -tester paddedglob(make_name(pad(bad))); // expected-error {{call to consteval function 'GH58207::make_name' is not a constant expression}} \ +tester paddedglob(make_name(pad(bad))); // expected-error {{call to consteval function 'GH58207::tester::tester' is not a constant expression}} \ // expected-note {{read of non-const variable 'bad' is not allowed in a constant expression}} constexpr tester glob3 = { make_name("glob3") }; -constexpr tester glob4 = { make_name(pad(bad)) }; // expected-error {{call to consteval function 'GH58207::make_name' is not a constant expression}} \ - // expected-error {{constexpr variable 'glob4' must be initialized by a constant expression}} \ - // expected-note 2{{read of non-const variable 'bad' is not allowed in a constant expression}} +constexpr tester glob4 = { make_name(pad(bad)) }; // expected-error {{constexpr variable 'glob4' must be initialized by a constant expression}} \ + // expected-note {{read of non-const variable 'bad' is not allowed in a constant expression}} auto V = make_name(pad(3)); auto V1 = make_name(pad(bad)); // expected-error {{call to consteval function 'GH58207::make_name' is not a constant expression}} \ @@ -1094,12 +1092,12 @@ void foo() { static tester loc1(make_name("loc1")); static constexpr tester loc2(make_name("loc2")); - static tester paddedloc(make_name(pad(bad))); // expected-error {{call to consteval function 'GH58207::make_name' is not a constant expression}} \ + static tester paddedloc(make_name(pad(bad))); // expected-error {{call to consteval function 'GH58207::tester::tester' is not a constant expression}} \ // expected-note {{read of non-const variable 'bad' is not allowed in a constant expression}} } void bar() { - static tester paddedloc(make_name(pad(bad))); // expected-error {{call to consteval function 'GH58207::make_name' is not a constant expression}} \ + static tester paddedloc(make_name(pad(bad))); // expected-error {{call to consteval function 'GH58207::tester::tester' is not a constant expression}} \ // expected-note {{read of non-const variable 'bad' is not allowed in a constant expression}} } } Index: clang/test/SemaCXX/cxx2b-consteval-if.cpp =================================================================== --- clang/test/SemaCXX/cxx2b-consteval-if.cpp +++ clang/test/SemaCXX/cxx2b-consteval-if.cpp @@ -18,7 +18,7 @@ constexpr auto i() { if consteval { - if consteval { // expected-warning {{consteval if is always true in an immediate context}} + if consteval { // expected-warning {{consteval if is always true in this context}} return 1; } return 2; Index: clang/test/SemaCXX/cxx2b-consteval-propagate.cpp =================================================================== --- clang/test/SemaCXX/cxx2b-consteval-propagate.cpp +++ clang/test/SemaCXX/cxx2b-consteval-propagate.cpp @@ -209,7 +209,7 @@ SS::SS(){} // expected-note {{in the default initializer of 'x'}} consteval int f2(int x) { - if (!__builtin_is_constant_evaluated()) side_effect(); + if (!__builtin_is_constant_evaluated()) side_effect(); // expected-warning {{'__builtin_is_constant_evaluated' will always evaluate to true}} return x; } struct S2 { Index: clang/test/SemaCXX/vartemplate-lambda.cpp =================================================================== --- clang/test/SemaCXX/vartemplate-lambda.cpp +++ clang/test/SemaCXX/vartemplate-lambda.cpp @@ -12,7 +12,7 @@ struct S { template - static constexpr T t = [](int f = T(7)){return f;}(); // expected-error{{constexpr variable 't' must be initialized by a constant expression}} expected-note{{cannot be used in a constant expression}} + static constexpr T t = [](int f = T(7)){return f;}(); // expected-error{{a lambda expression may not appear inside of a constant expression}} }; template @@ -21,7 +21,7 @@ fn1(a); (void)v1; (void)v1; // expected-note{{in instantiation of variable template specialization 'v1' requested here}} - (void)S::t; // expected-note{{in instantiation of static data member 'S::t' requested here}} + (void)S::t; return 0; } Index: clang/test/SemaCXX/warn-constant-evaluated-constexpr.cpp =================================================================== --- clang/test/SemaCXX/warn-constant-evaluated-constexpr.cpp +++ clang/test/SemaCXX/warn-constant-evaluated-constexpr.cpp @@ -7,35 +7,35 @@ } // namespace std constexpr int fn1() { - if constexpr (std::is_constant_evaluated()) // expected-warning {{'std::is_constant_evaluated' will always evaluate to 'true' in a manifestly constant-evaluated expression}} + if constexpr (std::is_constant_evaluated()) // expected-warning {{'std::is_constant_evaluated' will always evaluate to true in this context}} return 0; else return 1; } constexpr int fn2() { - if constexpr (!std::is_constant_evaluated()) // expected-warning {{'std::is_constant_evaluated' will always evaluate to 'true' in a manifestly constant-evaluated expression}} + if constexpr (!std::is_constant_evaluated()) // expected-warning {{'std::is_constant_evaluated' will always evaluate to true in this context}} return 0; else return 1; } constexpr int fn3() { - if constexpr (std::is_constant_evaluated() == false) // expected-warning {{'std::is_constant_evaluated' will always evaluate to 'true' in a manifestly constant-evaluated expression}} + if constexpr (std::is_constant_evaluated() == false) // expected-warning {{'std::is_constant_evaluated' will always evaluate to true in this context}} return 0; else return 1; } constexpr int fn4() { - if constexpr (__builtin_is_constant_evaluated() == true) // expected-warning {{'__builtin_is_constant_evaluated' will always evaluate to 'true' in a manifestly constant-evaluated expression}} + if constexpr (__builtin_is_constant_evaluated() == true) // expected-warning {{'__builtin_is_constant_evaluated' will always evaluate to true in this context}} return 0; else return 1; } constexpr int fn5() { - if constexpr (__builtin_is_constant_evaluated()) // expected-warning {{'__builtin_is_constant_evaluated' will always evaluate to 'true' in a manifestly constant-evaluated expression}} + if constexpr (__builtin_is_constant_evaluated()) // expected-warning {{'__builtin_is_constant_evaluated' will always evaluate to true in this context}} return 0; else return 1; Index: clang/test/SemaCXX/warn-tautological-meta-constant.cpp =================================================================== --- /dev/null +++ clang/test/SemaCXX/warn-tautological-meta-constant.cpp @@ -0,0 +1,170 @@ +// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify %s + +namespace std { +constexpr inline bool + is_constant_evaluated() noexcept { + if consteval { return true; } else { return false; } + } +} // namespace std + +namespace P1938 { + constexpr int f1() { + if constexpr (!std::is_constant_evaluated() && sizeof(int) == 4) { // expected-warning {{always evaluate to true}} + return 0; + } + if (std::is_constant_evaluated()) { + return 42; + } else { + if constexpr (std::is_constant_evaluated()) { // expected-warning {{always evaluate to true}} + return 0; + } + } + return 7; +} + + +consteval int f2() { + if (std::is_constant_evaluated() && f1()) { // expected-warning {{always evaluate to true}} + return 42; + } + return 7; +} + + +int f3() { + if (std::is_constant_evaluated() && f1()) { // expected-warning {{always evaluate to false}} + return 42; + } + return 7; +} +} + +void non_qual() { + int ff = std::is_constant_evaluated(); // expected-warning {{always evaluate to false}} + const int aa = std::is_constant_evaluated(); + constexpr int tt = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + static int bb = std::is_constant_evaluated(); + constexpr int cc = [](){ + if consteval {return 8;} // expected-warning {{always true}} + }(); + auto lamda = []() { + if consteval {return 8;} + else {return 4;} + }; + auto lamda_const = []() consteval { + if consteval {return 8;} // expected-warning {{always true}} + else {return 4;} + }; + if consteval { // expected-warning {{always false}} + int b = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + } +} + +constexpr void in_constexpr() { + int aa = std::is_constant_evaluated(); + constexpr int bb = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + const int cc = std::is_constant_evaluated(); + if consteval { + int dd = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + constexpr int ee = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + const int ff = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + } else { + int dd = std::is_constant_evaluated(); // expected-warning {{always evaluate to false}} + constexpr int ee = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + const int ff = std::is_constant_evaluated(); + const int qq = std::is_constant_evaluated() ? dd : 3; + } + + if consteval { + if consteval {} // expected-warning {{always true}} + if !consteval {} // expected-warning {{always false}} + } else { + if consteval {} // expected-warning {{always false}} + if !consteval {} // expected-warning {{always true}} + } + if !consteval { + if consteval {} // expected-warning {{always false}} + if !consteval {} // expected-warning {{always true}} + } else { + if consteval {} // expected-warning {{always true}} + if !consteval {} // expected-warning {{always false}} + } +} + +consteval void in_consteval() { + int aa = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + constexpr int bb = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + const int cc = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + auto lambda = []() { + int a(std::is_constant_evaluated()); // expected-warning {{always evaluate to true}} + constexpr int b = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + const int c = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + }; + if !consteval {} // expected-warning {{always false}} +} + +static_assert(std::is_constant_evaluated()); // expected-warning {{always evaluate to true}} +static_assert(__builtin_is_constant_evaluated()); // expected-warning {{always evaluate to true}} + +template +void templ() { + if constexpr(std::is_constant_evaluated()) {} // expected-warning {{always evaluate to true}} + constexpr bool c = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + if consteval {} // expected-warning {{always false}} +} + +template <> void templ() { // expected-warning {{always evaluate to true}} + if constexpr(std::is_constant_evaluated()) {} // expected-warning {{always evaluate to true}} + constexpr bool c = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + if consteval {} // expected-warning {{always false}} + templ(); +} + +static_assert([] { + if consteval { // expected-warning {{always true}} + return 0; + } else { + return 1; + } + }() == 0); +constexpr bool b = __builtin_is_constant_evaluated(); // expected-warning {{always evaluate to true}} +constexpr bool c = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} +constinit bool d = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} +int p = __builtin_is_constant_evaluated(); +const int q = __builtin_is_constant_evaluated(); + +template // expected-warning {{always evaluate to true}} +void vvv() { + return; +} + +template<> void vvv() {} +template<> void vvv() {} + +template concept C = __builtin_is_constant_evaluated();// expected-warning {{always evaluate to true}} + +struct Foo { + static constexpr bool ce = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + const static bool nonce = std::is_constant_evaluated(); + bool b = std::is_constant_evaluated(); + + Foo() { + if constexpr(std::is_constant_evaluated()) {} // expected-warning {{always evaluate to true}} + bool aa = std::is_constant_evaluated(); // expected-warning {{always evaluate to false}} + static bool bb = std::is_constant_evaluated(); + constexpr bool cc = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + if consteval {} // expected-warning {{always false}} + } + constexpr Foo(int) { + if constexpr(std::is_constant_evaluated()) {} // expected-warning {{always evaluate to true}} + bool aa = std::is_constant_evaluated(); + static bool bb = std::is_constant_evaluated(); + constexpr bool cc = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + } + consteval Foo(int *) { + if constexpr(std::is_constant_evaluated()) {} // expected-warning {{always evaluate to true}} + bool aa = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + static bool bb = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + constexpr bool cc = std::is_constant_evaluated(); // expected-warning {{always evaluate to true}} + } +}; Index: clang/test/SemaTemplate/concepts.cpp =================================================================== --- clang/test/SemaTemplate/concepts.cpp +++ clang/test/SemaTemplate/concepts.cpp @@ -135,21 +135,21 @@ namespace BuiltinIsConstantEvaluated { // Check that we do all satisfaction and diagnostic checks in a constant context. - template concept C = __builtin_is_constant_evaluated(); // expected-warning {{always}} + template concept C = __builtin_is_constant_evaluated(); // expected-warning {{always evaluate to true}} static_assert(C); - template concept D = __builtin_is_constant_evaluated() == true; // expected-warning {{always}} + template concept D = __builtin_is_constant_evaluated() == true; // expected-warning {{always evaluate to true}} static_assert(D); - template concept E = __builtin_is_constant_evaluated() == true && // expected-warning {{always}} + template concept E = __builtin_is_constant_evaluated() == true && // expected-warning {{always evaluate to true}} false; // expected-note {{'false' evaluated to false}} static_assert(E); // expected-error {{failed}} expected-note {{because 'int' does not satisfy 'E'}} - template concept F = __builtin_is_constant_evaluated() == false; // expected-warning {{always}} + template concept F = __builtin_is_constant_evaluated() == false; // expected-warning {{always evaluate to true}} // expected-note@-1 {{'__builtin_is_constant_evaluated() == false' (1 == 0)}} static_assert(F); // expected-error {{failed}} expected-note {{because 'int' does not satisfy 'F'}} - template concept G = __builtin_is_constant_evaluated() && // expected-warning {{always}} + template concept G = __builtin_is_constant_evaluated() && // expected-warning {{always evaluate to true}} false; // expected-note {{'false' evaluated to false}} static_assert(G); // expected-error {{failed}} expected-note {{because 'int' does not satisfy 'G'}} } Index: clang/unittests/Support/TimeProfilerTest.cpp =================================================================== --- clang/unittests/Support/TimeProfilerTest.cpp +++ clang/unittests/Support/TimeProfilerTest.cpp @@ -188,7 +188,6 @@ | EvaluateAsBooleanCondition () | | EvaluateAsRValue () | EvaluateAsInitializer (slow_value) -| EvaluateAsConstantExpr () | EvaluateAsConstantExpr () | EvaluateAsRValue () | EvaluateAsInitializer (slow_init_list) Index: libcxx/include/__type_traits/is_constant_evaluated.h =================================================================== --- libcxx/include/__type_traits/is_constant_evaluated.h +++ libcxx/include/__type_traits/is_constant_evaluated.h @@ -24,7 +24,11 @@ #endif _LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR bool __libcpp_is_constant_evaluated() _NOEXCEPT { +#ifndef _LIBCPP_CXX03_LANG return __builtin_is_constant_evaluated(); +#else + return false; +#endif } _LIBCPP_END_NAMESPACE_STD Index: libcxx/test/libcxx/algorithms/robust_against_copying_comparators.pass.cpp =================================================================== --- libcxx/test/libcxx/algorithms/robust_against_copying_comparators.pass.cpp +++ libcxx/test/libcxx/algorithms/robust_against_copying_comparators.pass.cpp @@ -140,7 +140,7 @@ #endif (void)std::is_sorted(first, last, Less(&copies)); assert(copies == 0); (void)std::is_sorted_until(first, last, Less(&copies)); assert(copies == 0); - if (!TEST_IS_CONSTANT_EVALUATED) { (void)std::inplace_merge(first, mid, last, Less(&copies)); assert(copies == 0); } + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { (void)std::inplace_merge(first, mid, last, Less(&copies)); assert(copies == 0); } (void)std::lexicographical_compare(first, last, first2, last2, Less(&copies)); assert(copies == 0); #if TEST_STD_VER > 17 (void)std::lexicographical_compare_three_way(first, last, first2, last2, ThreeWay(&copies)); assert(copies == 0); @@ -195,8 +195,8 @@ (void)std::sort(first, first+5, Less(&copies)); assert(copies == 0); (void)std::sort(first, last, Less(&copies)); assert(copies == 0); (void)std::sort_heap(first, last, Less(&copies)); assert(copies == 0); - if (!TEST_IS_CONSTANT_EVALUATED) { (void)std::stable_partition(first, last, UnaryTrue(&copies)); assert(copies == 0); } - if (!TEST_IS_CONSTANT_EVALUATED) { (void)std::stable_sort(first, last, Less(&copies)); assert(copies == 0); } + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { (void)std::stable_partition(first, last, UnaryTrue(&copies)); assert(copies == 0); } + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { (void)std::stable_sort(first, last, Less(&copies)); assert(copies == 0); } (void)std::transform(first, last, first2, UnaryTransform(&copies)); assert(copies == 0); (void)std::transform(first, mid, mid, first2, BinaryTransform(&copies)); assert(copies == 0); (void)std::unique(first, last, Equal(&copies)); assert(copies == 0); Index: libcxx/test/libcxx/strings/basic.string/string.capacity/PR53170.pass.cpp =================================================================== --- libcxx/test/libcxx/strings/basic.string/string.capacity/PR53170.pass.cpp +++ libcxx/test/libcxx/strings/basic.string/string.capacity/PR53170.pass.cpp @@ -34,7 +34,7 @@ template TEST_CONSTEXPR_CXX20 bool test() { // Test that a call to reserve() does shrink the string. - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { S s(1000, 'a'); typename S::size_type old_cap = s.capacity(); s.resize(20); Index: libcxx/test/std/algorithms/alg.modifying.operations/alg.copy/ranges.copy.segmented.pass.cpp =================================================================== --- libcxx/test/std/algorithms/alg.modifying.operations/alg.copy/ranges.copy.segmented.pass.cpp +++ libcxx/test/std/algorithms/alg.modifying.operations/alg.copy/ranges.copy.segmented.pass.cpp @@ -93,12 +93,10 @@ } int main(int, char**) { - if (!std::is_constant_evaluated()) { - test_containers, std::deque>(); - test_containers, std::vector>(); - test_containers, std::deque>(); - test_containers, std::vector>(); - } + test_containers, std::deque>(); + test_containers, std::vector>(); + test_containers, std::deque>(); + test_containers, std::vector>(); types::for_each(types::forward_iterator_list{}, [] { test_join_view(); Index: libcxx/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp =================================================================== --- libcxx/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp +++ libcxx/test/std/algorithms/alg.modifying.operations/alg.move/move.pass.cpp @@ -94,7 +94,7 @@ TEST_CONSTEXPR_CXX20 bool test() { types::for_each(types::cpp17_input_iterator_list(), TestOutIters()); - if (TEST_STD_VER >= 23 || !TEST_IS_CONSTANT_EVALUATED) + if (TEST_STD_VER >= 23 || !TEST_IS_CONSTANT_EVALUATED_CXX20) types::for_each(types::cpp17_input_iterator_list*>(), Test1OutIters()); { // Make sure that padding bits aren't copied Index: libcxx/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp =================================================================== --- libcxx/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp +++ libcxx/test/std/algorithms/alg.modifying.operations/alg.move/move_backward.pass.cpp @@ -92,7 +92,7 @@ TEST_CONSTEXPR_CXX20 bool test() { types::for_each(types::bidirectional_iterator_list(), TestOutIters()); - if (TEST_STD_VER >= 23 || !TEST_IS_CONSTANT_EVALUATED) + if (TEST_STD_VER >= 23 || !TEST_IS_CONSTANT_EVALUATED_CXX20) types::for_each(types::bidirectional_iterator_list*>(), Test1OutIters()); { // Make sure that padding bits aren't copied Index: libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find.pass.cpp =================================================================== --- libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find.pass.cpp +++ libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find.pass.cpp @@ -71,7 +71,7 @@ assert(base(iter) == arr + 10); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) comparable_data.clear(); } }; Index: libcxx/test/std/algorithms/robust_against_proxy_iterators_lifetime_bugs.pass.cpp =================================================================== --- libcxx/test/std/algorithms/robust_against_proxy_iterators_lifetime_bugs.pass.cpp +++ libcxx/test/std/algorithms/robust_against_proxy_iterators_lifetime_bugs.pass.cpp @@ -731,15 +731,15 @@ test(simple_in, [&](I b, I e) { (void) std::remove_if(b, e, is_neg); }); test(simple_in, [&](I b, I e) { (void) std::reverse(b, e); }); // TODO: rotate - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) test(simple_in, [&](I b, I e) { (void) std::shuffle(b, e, rand_gen()); }); // TODO: unique test(simple_in, [&](I b, I e) { (void) std::partition(b, e, is_neg); }); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) test(simple_in, [&](I b, I e) { (void) std::stable_partition(b, e, is_neg); }); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) test(sort_test_in, [&](I b, I e) { (void) std::sort(b, e); }); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) test(sort_test_in, [&](I b, I e) { (void) std::stable_sort(b, e); }); // TODO: partial_sort // TODO: nth_element Index: libcxx/test/std/algorithms/robust_re_difference_type.compile.pass.cpp =================================================================== --- libcxx/test/std/algorithms/robust_re_difference_type.compile.pass.cpp +++ libcxx/test/std/algorithms/robust_re_difference_type.compile.pass.cpp @@ -140,8 +140,8 @@ (void)std::is_sorted(first, last, std::less()); (void)std::is_sorted_until(first, last); (void)std::is_sorted_until(first, last, std::less()); - if (!TEST_IS_CONSTANT_EVALUATED) (void)std::inplace_merge(first, mid, last); - if (!TEST_IS_CONSTANT_EVALUATED) (void)std::inplace_merge(first, mid, last, std::less()); + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) (void)std::inplace_merge(first, mid, last); + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) (void)std::inplace_merge(first, mid, last, std::less()); (void)std::iter_swap(first, mid); (void)std::lexicographical_compare(first, last, first2, last2); (void)std::lexicographical_compare(first, last, first2, last2, std::less()); @@ -239,9 +239,9 @@ (void)std::sort(first, last, std::less()); (void)std::sort_heap(first, last); (void)std::sort_heap(first, last, std::less()); - if (!TEST_IS_CONSTANT_EVALUATED) (void)std::stable_partition(first, last, UnaryTrue()); - if (!TEST_IS_CONSTANT_EVALUATED) (void)std::stable_sort(first, last); - if (!TEST_IS_CONSTANT_EVALUATED) (void)std::stable_sort(first, last, std::less()); + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) (void)std::stable_partition(first, last, UnaryTrue()); + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) (void)std::stable_sort(first, last); + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) (void)std::stable_sort(first, last, std::less()); (void)std::swap_ranges(first, last, first2); (void)std::transform(first, last, first2, UnaryTransform()); (void)std::transform(first, mid, mid, first2, BinaryTransform()); Index: libcxx/test/std/containers/sequences/vector.bool/reserve.pass.cpp =================================================================== --- libcxx/test/std/containers/sequences/vector.bool/reserve.pass.cpp +++ libcxx/test/std/containers/sequences/vector.bool/reserve.pass.cpp @@ -59,7 +59,7 @@ } #endif #ifndef TEST_HAS_NO_EXCEPTIONS - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { std::vector > v; v.reserve(5); try { Index: libcxx/test/std/containers/sequences/vector/access.pass.cpp =================================================================== --- libcxx/test/std/containers/sequences/vector/access.pass.cpp +++ libcxx/test/std/containers/sequences/vector/access.pass.cpp @@ -45,7 +45,7 @@ assert(c.at(i) == start_value + i); #ifndef TEST_HAS_NO_EXCEPTIONS - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { TEST_IGNORE_NODISCARD c.at(n); assert(false); Index: libcxx/test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp =================================================================== --- libcxx/test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp +++ libcxx/test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp @@ -49,7 +49,7 @@ assert(is_contiguous_container_asan_correct(v)); } #ifndef TEST_HAS_NO_EXCEPTIONS - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { std::vector v; std::size_t sz = v.max_size() + 1; @@ -61,7 +61,7 @@ assert(v.capacity() == 0); } } - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { std::vector v(10, 42); int* previous_data = v.data(); std::size_t previous_capacity = v.capacity(); @@ -118,7 +118,7 @@ } #endif #ifndef TEST_HAS_NO_EXCEPTIONS - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { std::vector > v; v.reserve(50); assert(v.capacity() == 50); Index: libcxx/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp =================================================================== --- libcxx/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp +++ libcxx/test/std/containers/sequences/vector/vector.capacity/shrink_to_fit.pass.cpp @@ -37,7 +37,7 @@ assert(is_contiguous_container_asan_correct(v)); } #ifndef TEST_HAS_NO_EXCEPTIONS - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { std::vector > v(100); v.push_back(1); assert(is_contiguous_container_asan_correct(v)); Index: libcxx/test/std/strings/basic.string/string.access/at.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.access/at.pass.cpp +++ libcxx/test/std/strings/basic.string/string.access/at.pass.cpp @@ -32,7 +32,7 @@ assert(cs.at(pos) == cs[pos]); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp +++ libcxx/test/std/strings/basic.string/string.capacity/reserve_size.pass.cpp @@ -46,7 +46,7 @@ #endif } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp +++ libcxx/test/std/strings/basic.string/string.capacity/resize_size.pass.cpp @@ -28,7 +28,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp +++ libcxx/test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp @@ -28,7 +28,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp +++ libcxx/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp @@ -43,7 +43,7 @@ assert(s2.capacity() >= s2.size()); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { @@ -76,7 +76,7 @@ assert(s2.capacity() >= s2.size()); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp +++ libcxx/test/std/strings/basic.string/string.cons/copy_alloc.pass.cpp @@ -106,7 +106,7 @@ } #ifndef TEST_HAS_NO_EXCEPTIONS - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { typedef poca_alloc A; typedef std::basic_string, A> S; const char * p1 = "This is my first string"; Index: libcxx/test/std/strings/basic.string/string.cons/substr.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.cons/substr.pass.cpp +++ libcxx/test/std/strings/basic.string/string.cons/substr.pass.cpp @@ -45,7 +45,7 @@ assert(s2.capacity() >= s2.size()); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { @@ -77,7 +77,7 @@ assert(s2.capacity() >= s2.size()); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { @@ -109,7 +109,7 @@ assert(s2.capacity() >= s2.size()); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp @@ -30,7 +30,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { @@ -56,7 +56,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp @@ -118,7 +118,7 @@ #endif #ifndef TEST_HAS_NO_EXCEPTIONS - if (!TEST_IS_CONSTANT_EVALUATED) { // test iterator operations that throw + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { // test iterator operations that throw typedef std::string S; typedef ThrowingIterator TIter; typedef cpp17_input_iterator IIter; @@ -175,7 +175,7 @@ s_sneaky.reserve(12); test(s_sneaky, s_sneaky.data(), s_sneaky.data() + 6, std::string("hellohello\0", 11)); - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { const unsigned char *first = reinterpret_cast(s_othertype.data()); test(s_othertype, first + 2, first + 5, std::string("hellollo")); } Index: libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp @@ -30,7 +30,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { @@ -56,7 +56,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp @@ -29,7 +29,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { @@ -55,7 +55,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp @@ -118,7 +118,7 @@ #endif #ifndef TEST_HAS_NO_EXCEPTIONS - if (!TEST_IS_CONSTANT_EVALUATED) { // test iterator operations that throw + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { // test iterator operations that throw typedef std::string S; typedef ThrowingIterator TIter; typedef cpp17_input_iterator IIter; Index: libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp @@ -30,7 +30,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { @@ -56,7 +56,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp @@ -33,7 +33,7 @@ assert(S::traits_type::eq(cs[pos+r], s[r])); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp @@ -32,7 +32,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { @@ -62,7 +62,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp @@ -109,7 +109,7 @@ #endif #ifndef TEST_HAS_NO_EXCEPTIONS - if (!TEST_IS_CONSTANT_EVALUATED) { // test iterator operations that throw + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { // test iterator operations that throw typedef std::string S; typedef ThrowingIterator TIter; typedef cpp17_input_iterator IIter; @@ -152,7 +152,7 @@ assert(s == "ABCD"); } - if (!TEST_IS_CONSTANT_EVALUATED) { // regression-test inserting into self in sneaky ways + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { // regression-test inserting into self in sneaky ways std::string s_short = "hello"; std::string s_long = "Lorem ipsum dolor sit amet, consectetur/"; std::string s_othertype = "hello"; Index: libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp @@ -35,7 +35,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { @@ -65,7 +65,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp @@ -31,7 +31,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp @@ -32,7 +32,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp @@ -32,7 +32,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp @@ -31,7 +31,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp @@ -34,7 +34,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { @@ -63,7 +63,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_insert/string_view.pass.cpp @@ -31,7 +31,7 @@ assert(s == expected); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp @@ -995,7 +995,7 @@ template TEST_CONSTEXPR_CXX20 bool test9() { #ifndef TEST_HAS_NO_EXCEPTIONS - if (!TEST_IS_CONSTANT_EVALUATED) { // test iterator operations that throw + if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { // test iterator operations that throw typedef ThrowingIterator TIter; typedef cpp17_input_iterator IIter; const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; Index: libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp @@ -49,7 +49,7 @@ assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { @@ -85,7 +85,7 @@ assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp @@ -36,7 +36,7 @@ assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp @@ -37,7 +37,7 @@ assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp @@ -37,7 +37,7 @@ assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp @@ -35,7 +35,7 @@ assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp @@ -41,7 +41,7 @@ assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { @@ -75,7 +75,7 @@ assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp +++ libcxx/test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_view.pass.cpp @@ -35,7 +35,7 @@ assert(s.size() == old_size - xlen + rlen); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp +++ libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp @@ -40,7 +40,7 @@ if (pos1 <= s.size() && pos2 <= sv.size()) assert(sign(s.compare(pos1, n1, sv, pos2, n2)) == sign(x)); #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { @@ -64,7 +64,7 @@ if (pos1 <= s.size() && pos2 <= sv.size()) assert(sign(s.compare(pos1, n1, sv, pos2)) == sign(x)); #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp +++ libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp @@ -35,7 +35,7 @@ if (pos1 <= s.size()) assert(sign(s.compare(pos1, n1, str)) == sign(x)); #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp +++ libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp @@ -35,7 +35,7 @@ if (pos <= s.size()) assert(sign(s.compare(pos, n1, str, n2)) == sign(x)); #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp +++ libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp @@ -34,7 +34,7 @@ if (pos1 <= s.size()) assert(sign(s.compare(pos1, n1, str)) == sign(x)); #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp +++ libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp @@ -39,7 +39,7 @@ if (pos1 <= s.size() && pos2 <= str.size()) assert(sign(s.compare(pos1, n1, str, pos2, n2)) == sign(x)); #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { @@ -62,7 +62,7 @@ if (pos1 <= s.size() && pos2 <= str.size()) assert(sign(s.compare(pos1, n1, str, pos2)) == sign(x)); #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp +++ libcxx/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp @@ -35,7 +35,7 @@ if (pos1 <= s.size()) assert(sign(s.compare(pos1, n1, sv)) == sign(x)); #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp =================================================================== --- libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp +++ libcxx/test/std/strings/basic.string/string.ops/string_substr/substr.pass.cpp @@ -34,7 +34,7 @@ assert(S::traits_type::compare(s.data()+pos, str.data(), rlen) == 0); } #ifndef TEST_HAS_NO_EXCEPTIONS - else if (!TEST_IS_CONSTANT_EVALUATED) + else if (!TEST_IS_CONSTANT_EVALUATED_CXX20) { try { Index: libcxx/test/std/strings/string.view/string.view.comparison/equal.pass.cpp =================================================================== --- libcxx/test/std/strings/string.view/string.view.comparison/equal.pass.cpp +++ libcxx/test/std/strings/string.view/string.view.comparison/equal.pass.cpp @@ -54,7 +54,7 @@ assert((ConvertibleTo(v[i]) == v[j]) == expected); assert((v[i] == ConvertibleTo(v[j])) == expected); - if (!TEST_IS_CONSTANT_EVALUATED || TEST_STD_VER >= 20) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX14 || TEST_STD_VER >= 20) { assert((std::basic_string(v[i]) == v[j]) == expected); assert((v[i] == std::basic_string(v[j])) == expected); } @@ -75,7 +75,7 @@ assert((abc.data() == abc0def) == false); assert((abc0def == abc.data()) == false); - if (!TEST_IS_CONSTANT_EVALUATED || TEST_STD_VER >= 20) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX14 || TEST_STD_VER >= 20) { assert((std::basic_string(abc) == abc0def) == false); assert((abc0def == std::basic_string(abc)) == false); } Index: libcxx/test/std/strings/string.view/string.view.comparison/greater.pass.cpp =================================================================== --- libcxx/test/std/strings/string.view/string.view.comparison/greater.pass.cpp +++ libcxx/test/std/strings/string.view/string.view.comparison/greater.pass.cpp @@ -54,7 +54,7 @@ assert((ConvertibleTo(v[i]) > v[j]) == expected); assert((v[i] > ConvertibleTo(v[j])) == expected); - if (!TEST_IS_CONSTANT_EVALUATED || TEST_STD_VER >= 20) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX14 || TEST_STD_VER >= 20) { assert((std::basic_string(v[i]) > v[j]) == expected); assert((v[i] > std::basic_string(v[j])) == expected); } @@ -75,7 +75,7 @@ assert((abc.data() > abc0def) == false); assert((abc0def > abc.data()) == true); - if (!TEST_IS_CONSTANT_EVALUATED || TEST_STD_VER >= 20) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX14 || TEST_STD_VER >= 20) { assert((std::basic_string(abc) > abc0def) == false); assert((abc0def > std::basic_string(abc)) == true); } Index: libcxx/test/std/strings/string.view/string.view.comparison/greater_equal.pass.cpp =================================================================== --- libcxx/test/std/strings/string.view/string.view.comparison/greater_equal.pass.cpp +++ libcxx/test/std/strings/string.view/string.view.comparison/greater_equal.pass.cpp @@ -54,7 +54,7 @@ assert((ConvertibleTo(v[i]) >= v[j]) == expected); assert((v[i] >= ConvertibleTo(v[j])) == expected); - if (!TEST_IS_CONSTANT_EVALUATED || TEST_STD_VER >= 20) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX14 || TEST_STD_VER >= 20) { assert((std::basic_string(v[i]) >= v[j]) == expected); assert((v[i] >= std::basic_string(v[j])) == expected); } @@ -75,7 +75,7 @@ assert((abc.data() >= abc0def) == false); assert((abc0def >= abc.data()) == true); - if (!TEST_IS_CONSTANT_EVALUATED || TEST_STD_VER >= 20) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX14 || TEST_STD_VER >= 20) { assert((std::basic_string(abc) >= abc0def) == false); assert((abc0def >= std::basic_string(abc)) == true); } Index: libcxx/test/std/strings/string.view/string.view.comparison/less.pass.cpp =================================================================== --- libcxx/test/std/strings/string.view/string.view.comparison/less.pass.cpp +++ libcxx/test/std/strings/string.view/string.view.comparison/less.pass.cpp @@ -54,7 +54,7 @@ assert((ConvertibleTo(v[i]) < v[j]) == expected); assert((v[i] < ConvertibleTo(v[j])) == expected); - if (!TEST_IS_CONSTANT_EVALUATED || TEST_STD_VER >= 20) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX14 || TEST_STD_VER >= 20) { assert((std::basic_string(v[i]) < v[j]) == expected); assert((v[i] < std::basic_string(v[j])) == expected); } @@ -75,7 +75,7 @@ assert((abc.data() < abc0def) == true); assert((abc0def < abc.data()) == false); - if (!TEST_IS_CONSTANT_EVALUATED || TEST_STD_VER >= 20) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX14 || TEST_STD_VER >= 20) { assert((std::basic_string(abc) < abc0def) == true); assert((abc0def < std::basic_string(abc)) == false); } Index: libcxx/test/std/strings/string.view/string.view.comparison/less_equal.pass.cpp =================================================================== --- libcxx/test/std/strings/string.view/string.view.comparison/less_equal.pass.cpp +++ libcxx/test/std/strings/string.view/string.view.comparison/less_equal.pass.cpp @@ -54,7 +54,7 @@ assert((ConvertibleTo(v[i]) <= v[j]) == expected); assert((v[i] <= ConvertibleTo(v[j])) == expected); - if (!TEST_IS_CONSTANT_EVALUATED || TEST_STD_VER >= 20) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX14 || TEST_STD_VER >= 20) { assert((std::basic_string(v[i]) <= v[j]) == expected); assert((v[i] <= std::basic_string(v[j])) == expected); } @@ -75,7 +75,7 @@ assert((abc.data() <= abc0def) == true); assert((abc0def <= abc.data()) == false); - if (!TEST_IS_CONSTANT_EVALUATED || TEST_STD_VER >= 20) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX14 || TEST_STD_VER >= 20) { assert((std::basic_string(abc) <= abc0def) == true); assert((abc0def <= std::basic_string(abc)) == false); } Index: libcxx/test/std/strings/string.view/string.view.comparison/not_equal.pass.cpp =================================================================== --- libcxx/test/std/strings/string.view/string.view.comparison/not_equal.pass.cpp +++ libcxx/test/std/strings/string.view/string.view.comparison/not_equal.pass.cpp @@ -54,7 +54,7 @@ assert((ConvertibleTo(v[i]) != v[j]) == expected); assert((v[i] != ConvertibleTo(v[j])) == expected); - if (!TEST_IS_CONSTANT_EVALUATED || TEST_STD_VER >= 20) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX14 || TEST_STD_VER >= 20) { assert((std::basic_string(v[i]) != v[j]) == expected); assert((v[i] != std::basic_string(v[j])) == expected); } @@ -75,7 +75,7 @@ assert((abc.data() != abc0def) == true); assert((abc0def != abc.data()) == true); - if (!TEST_IS_CONSTANT_EVALUATED || TEST_STD_VER >= 20) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX14 || TEST_STD_VER >= 20) { assert((std::basic_string(abc) != abc0def) == true); assert((abc0def != std::basic_string(abc)) == true); } Index: libcxx/test/std/utilities/meta/meta.const.eval/is_constant_evaluated.verify.cpp =================================================================== --- libcxx/test/std/utilities/meta/meta.const.eval/is_constant_evaluated.verify.cpp +++ libcxx/test/std/utilities/meta/meta.const.eval/is_constant_evaluated.verify.cpp @@ -24,7 +24,7 @@ #else // expected-error-re@+1 {{{{(static_assert|static assertion)}} failed}} static_assert(!std::is_constant_evaluated(), ""); - // expected-warning@-1 0-1 {{'std::is_constant_evaluated' will always evaluate to 'true' in a manifestly constant-evaluated expression}} + // expected-warning-re@-1 0-1 {{'std::is_constant_evaluated' will always evaluate to {{('true' in a manifestly constant-evaluated expression|true in this context)}}}} #endif return 0; } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move.pass.cpp @@ -40,32 +40,32 @@ std::unique_ptr s1(newValue(expect_alive)); A* p = s1.get(); std::unique_ptr s2(newValue(expect_alive)); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == (expect_alive * 2)); s2 = std::move(s1); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); assert(s2.get() == p); assert(s1.get() == 0); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); { std::unique_ptr > s1(newValue(expect_alive), Deleter(5)); A* p = s1.get(); std::unique_ptr > s2(newValue(expect_alive)); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == (expect_alive * 2)); s2 = std::move(s1); assert(s2.get() == p); assert(s1.get() == 0); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); assert(s2.get_deleter().state() == 5); assert(s1.get_deleter().state() == 0); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); { CDeleter d1(5); @@ -76,22 +76,22 @@ s2 = std::move(s1); assert(s2.get() == p); assert(s1.get() == 0); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); assert(d1.state() == 5); assert(d2.state() == 5); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); { std::unique_ptr s(newValue(expect_alive)); A* p = s.get(); s = std::move(s); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); assert(s.get() == p); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp @@ -407,13 +407,13 @@ { test_sfinae(); test_noexcept(); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) test_deleter_value_category(); } { test_sfinae(); test_noexcept(); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) test_deleter_value_category(); } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.single.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.single.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/move_convert.single.pass.cpp @@ -25,12 +25,12 @@ template TEST_CONSTEXPR_CXX23 void testAssign(APtr& aptr, BPtr& bptr) { A* p = bptr.get(); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 2); aptr = std::move(bptr); assert(aptr.get() == p); assert(bptr.get() == 0); - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 1); assert(B::count == 1); } @@ -124,7 +124,7 @@ std::unique_ptr aptr(new A); testAssign(aptr, bptr); } - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 0); assert(B::count == 0); } @@ -135,7 +135,7 @@ testAssign(aptr, bptr); checkDeleter(aptr, bptr, 42, 0); } - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 0); assert(B::count == 0); } @@ -147,7 +147,7 @@ testAssign(aptr, bptr); checkDeleter(aptr, bptr, 42, 42); } - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 0); assert(B::count == 0); } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/null.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/null.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/null.pass.cpp @@ -25,14 +25,14 @@ const int expect_alive = IsArray ? 5 : 1; { std::unique_ptr s2(newValue(expect_alive)); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); s2 = NULL; - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); assert(s2.get() == 0); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/nullptr.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/nullptr.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn/nullptr.pass.cpp @@ -26,14 +26,14 @@ const int expect_alive = IsArray ? 5 : 1; { std::unique_ptr s2(newValue(expect_alive)); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); s2 = nullptr; - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); assert(s2.get() == 0); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move.pass.cpp @@ -91,10 +91,10 @@ APtr s2 = std::move(s); assert(s2.get() == p); assert(s.get() == 0); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); { typedef Deleter MoveDel; @@ -107,12 +107,12 @@ APtr s2 = std::move(s); assert(s2.get() == p); assert(s.get() == 0); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); assert(s2.get_deleter().state() == 5); assert(s.get_deleter().state() == 0); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); { typedef NCDeleter NonCopyDel; @@ -124,23 +124,23 @@ APtr s2 = std::move(s); assert(s2.get() == p); assert(s.get() == 0); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); d.set_state(6); assert(s2.get_deleter().state() == d.state()); assert(s.get_deleter().state() == d.state()); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); { sink1(source1()); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); sink2(source2()); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.pass.cpp @@ -202,13 +202,13 @@ { test_sfinae(); test_noexcept(); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) test_deleter_value_category(); } { test_sfinae(); test_noexcept(); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) test_deleter_value_category(); } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.single.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.single.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/move_convert.single.pass.cpp @@ -50,14 +50,14 @@ TEST_CONSTEXPR_CXX23 void checkCtor(LHS& lhs, RHS& rhs, A* RHSVal) { assert(lhs.get() == RHSVal); assert(rhs.get() == nullptr); - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 1); assert(B::count == 1); } } TEST_CONSTEXPR_CXX23 void checkNoneAlive() { - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 0); assert(B::count == 0); } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer.pass.cpp @@ -56,55 +56,55 @@ #endif { A* p = newValue(expect_alive); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); std::unique_ptr s(p); assert(s.get() == p); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); { A* p = newValue(expect_alive); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); std::unique_ptr > s(p); assert(s.get() == p); assert(s.get_deleter().state() == 0); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); { A* p = newValue(expect_alive); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); std::unique_ptr > s(p); assert(s.get() == p); assert(s.get_deleter().state() == 0); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); } TEST_CONSTEXPR_CXX23 void test_derived() { { B* p = new B; - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 1); assert(B::count == 1); } std::unique_ptr s(p); assert(s.get() == p); } - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 0); assert(B::count == 0); } { B* p = new B; - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 1); assert(B::count == 1); } @@ -112,7 +112,7 @@ assert(s.get() == p); assert(s.get_deleter().state() == 0); } - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 0); assert(B::count == 0); } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer_deleter.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer_deleter.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.ctor/pointer_deleter.pass.cpp @@ -209,17 +209,17 @@ const int expect_alive = IsArray ? 5 : 1; { // MoveConstructible deleter (C-1) A* p = newValue(expect_alive); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); std::unique_ptr > s(p, Deleter(5)); assert(s.get() == p); assert(s.get_deleter().state() == 5); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); { // CopyConstructible deleter (C-2) A* p = newValue(expect_alive); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); CopyDeleter d(5); std::unique_ptr > s(p, d); @@ -228,11 +228,11 @@ d.set_state(6); assert(s.get_deleter().state() == 5); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); { // Reference deleter (C-3) A* p = newValue(expect_alive); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); NCDeleter d(5); std::unique_ptr&> s(p, d); @@ -242,11 +242,11 @@ d.set_state(6); assert(s.get_deleter().state() == 6); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); { // Const Reference deleter (C-4) A* p = newValue(expect_alive); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); NCConstDeleter d(5); std::unique_ptr const&> s(p, d); @@ -254,7 +254,7 @@ assert(s.get_deleter().state() == 5); assert(&s.get_deleter() == &d); } - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 0); { // Void and function pointers (C-6,7) typedef typename std::conditional::type VT2; @@ -272,13 +272,13 @@ } TEST_CONSTEXPR_CXX23 void test_basic_single() { - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 0); assert(B::count == 0); } { // Derived pointers (C-5) B* p = new B; - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 1); assert(B::count == 1); } @@ -286,7 +286,7 @@ assert(s.get() == p); assert(s.get_deleter().state() == 5); } - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 0); assert(B::count == 0); Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/release.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/release.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/release.pass.cpp @@ -31,11 +31,11 @@ #endif { std::unique_ptr p(newValue(expect_alive)); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); A* ap = p.get(); A* a = p.release(); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); assert(p.get() == nullptr); assert(ap == a); @@ -46,10 +46,10 @@ else delete a; - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.pass.cpp @@ -32,35 +32,35 @@ #endif { std::unique_ptr p(newValue(expect_alive)); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); A* i = p.get(); assert(i != nullptr); A* new_value = newValue(expect_alive); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == (expect_alive * 2)); p.reset(new_value); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); assert(p.get() == new_value); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); { std::unique_ptr p(newValue(expect_alive)); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); const A* i = p.get(); assert(i != nullptr); A* new_value = newValue(expect_alive); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == (expect_alive * 2)); p.reset(new_value); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); assert(p.get() == new_value); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); } @@ -78,16 +78,16 @@ #endif { std::unique_ptr p(newValue(expect_alive)); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); A* i = p.get(); assert(i != nullptr); p.reset(nullptr); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); assert(p.get() == nullptr); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); } @@ -105,16 +105,16 @@ #endif { std::unique_ptr p(newValue(expect_alive)); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == expect_alive); A* i = p.get(); assert(i != nullptr); p.reset(); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); assert(p.get() == nullptr); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.single.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.single.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/reset.single.pass.cpp @@ -21,37 +21,37 @@ TEST_CONSTEXPR_CXX23 bool test() { { std::unique_ptr p(new A); - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 1); assert(B::count == 0); } A* i = p.get(); assert(i != nullptr); p.reset(new B); - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 1); assert(B::count == 1); } } - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 0); assert(B::count == 0); } { std::unique_ptr p(new B); - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 1); assert(B::count == 1); } A* i = p.get(); assert(i != nullptr); p.reset(new B); - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 1); assert(B::count == 1); } } - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 0); assert(B::count == 0); } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/swap.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/swap.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.modifiers/swap.pass.cpp @@ -22,15 +22,15 @@ int state_; static int count; TEST_CONSTEXPR_CXX23 TT() : state_(-1) { - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) ++count; } TEST_CONSTEXPR_CXX23 explicit TT(int i) : state_(i) { - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) ++count; } TEST_CONSTEXPR_CXX23 TT(const TT& a) : state_(a.state_) { - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) ++count; } TEST_CONSTEXPR_CXX23 TT& operator=(const TT& a) { @@ -38,7 +38,7 @@ return *this; } TEST_CONSTEXPR_CXX23 ~TT() { - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) --count; } @@ -85,10 +85,10 @@ assert(s2.get() == p1); assert(*s2.get() == TT(1)); assert(s2.get_deleter().state() == 1); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(TT::count == (expect_alive * 2)); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(TT::count == 0); } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_subscript.runtime.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_subscript.runtime.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_subscript.runtime.pass.cpp @@ -15,7 +15,7 @@ #include #include -// TODO: Move TEST_IS_CONSTANT_EVALUATED into it's own header +// TODO: Move TEST_IS_CONSTANT_EVALUATED_CXX23 into it's own header #include #include "test_macros.h" @@ -26,7 +26,7 @@ public: TEST_CONSTEXPR_CXX23 A() : state_(0) { - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) state_ = ++next_; } @@ -44,7 +44,7 @@ TEST_CONSTEXPR_CXX23 bool test() { std::unique_ptr p(new A[3]); - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(p[0] == 1); assert(p[1] == 2); assert(p[2] == 3); Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/convert_ctor.pass.cpp @@ -22,14 +22,14 @@ std::default_delete d2; std::default_delete d1 = d2; A* p = new B; - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 1); assert(B::count == 1); } d1(p); - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(A::count == 0); assert(B::count == 0); } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt/default.pass.cpp @@ -19,12 +19,12 @@ TEST_CONSTEXPR_CXX23 bool test() { std::default_delete d; A* p = new A; - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 1); d(p); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); return true; Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.dltr/unique.ptr.dltr.dflt1/default.pass.cpp @@ -21,12 +21,12 @@ TEST_CONSTEXPR_CXX23 bool test() { std::default_delete d; A* p = new A[3]; - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 3); d(p); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); return true; Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.special/cmp.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.special/cmp.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.special/cmp.pass.cpp @@ -64,7 +64,7 @@ assert(!(p1 == p2)); assert(p1 != p2); - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert((p1 < p2) == (ptr1 < ptr2)); assert((p1 <= p2) == (ptr1 <= ptr2)); assert((p1 > p2) == (ptr1 > ptr2)); @@ -83,7 +83,7 @@ const std::unique_ptr > p2(ptr2); assert(!(p1 == p2)); assert(p1 != p2); - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert((p1 < p2) == (ptr1 < ptr2)); assert((p1 <= p2) == (ptr1 <= ptr2)); assert((p1 > p2) == (ptr1 > ptr2)); @@ -102,7 +102,7 @@ const std::unique_ptr > p2(ptr2); assert(!(p1 == p2)); assert(p1 != p2); - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert((p1 < p2) == (ptr1 < ptr2)); assert((p1 <= p2) == (ptr1 <= ptr2)); assert((p1 > p2) == (ptr1 > ptr2)); @@ -121,7 +121,7 @@ const std::unique_ptr > p2(ptr2); assert(!(p1 == p2)); assert(p1 != p2); - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert((p1 < p2) == (ptr1 < ptr2)); assert((p1 <= p2) == (ptr1 <= ptr2)); assert((p1 > p2) == (ptr1 > ptr2)); @@ -138,7 +138,7 @@ const std::unique_ptr > p2; assert(p1 == p2); #if TEST_STD_VER > 17 - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert((p1 <=> p2) == std::strong_ordering::equal); #endif } @@ -148,7 +148,7 @@ const std::unique_ptr > p2; assert(p1 == p2); #if TEST_STD_VER > 17 - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert((p1 <=> p2) == std::strong_ordering::equal); #endif } Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.special/cmp_nullptr.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.special/cmp_nullptr.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.special/cmp_nullptr.pass.cpp @@ -47,7 +47,7 @@ #include "test_comparisons.h" TEST_CONSTEXPR_CXX23 bool test() { - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { AssertEqualityAreNoexcept, nullptr_t>(); AssertEqualityAreNoexcept >(); AssertComparisonsReturnBool, nullptr_t>(); @@ -62,7 +62,7 @@ assert(!(p1 == nullptr)); assert(!(nullptr == p1)); // A pointer to allocated storage and a nullptr can't be compared at compile-time - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { assert(!(p1 < nullptr)); assert((nullptr < p1)); assert(!(p1 <= nullptr)); Index: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.special/swap.pass.cpp =================================================================== --- libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.special/swap.pass.cpp +++ libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.special/swap.pass.cpp @@ -23,15 +23,15 @@ int state_; static int count; TEST_CONSTEXPR_CXX23 A() : state_(0) { - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) ++count; } TEST_CONSTEXPR_CXX23 explicit A(int i) : state_(i) { - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) ++count; } TEST_CONSTEXPR_CXX23 A(const A& a) : state_(a.state_) { - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) ++count; } TEST_CONSTEXPR_CXX23 A& operator=(const A& a) { @@ -39,7 +39,7 @@ return *this; } TEST_CONSTEXPR_CXX23 ~A() { - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) --count; } @@ -78,10 +78,10 @@ assert(s2.get() == p1); assert(*s2 == A(1)); assert(s2.get_deleter().state() == 1); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 2); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); { A* p1 = new A[3]; @@ -97,10 +97,10 @@ assert(s1.get_deleter().state() == 2); assert(s2.get() == p1); assert(s2.get_deleter().state() == 1); - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 6); } - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) assert(A::count == 0); #if TEST_STD_VER >= 11 { Index: libcxx/test/std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp =================================================================== --- libcxx/test/std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp +++ libcxx/test/std/utilities/template.bitset/bitset.cons/char_ptr_ctor.pass.cpp @@ -24,7 +24,7 @@ TEST_CONSTEXPR_CXX23 void test_char_pointer_ctor() { #ifndef TEST_HAS_NO_EXCEPTIONS - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { try { std::bitset v("xxx1010101010xxxx"); assert(false); Index: libcxx/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp =================================================================== --- libcxx/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp +++ libcxx/test/std/utilities/template.bitset/bitset.cons/string_ctor.pass.cpp @@ -20,7 +20,7 @@ template TEST_CONSTEXPR_CXX23 void test_string_ctor() { #ifndef TEST_HAS_NO_EXCEPTIONS - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { try { std::string s("xxx1010101010xxxx"); std::bitset v(s, s.size()+1, 10); Index: libcxx/test/support/charconv_test_helpers.h =================================================================== --- libcxx/test/support/charconv_test_helpers.h +++ libcxx/test/support/charconv_test_helpers.h @@ -139,7 +139,7 @@ { char* last; long long r; - if (TEST_IS_CONSTANT_EVALUATED) + if (TEST_IS_CONSTANT_EVALUATED_CXX23) last = const_cast(std::from_chars(p, ep, r, base).ptr); else r = strtoll(p, &last, base); @@ -152,7 +152,7 @@ { char* last; unsigned long long r; - if (TEST_IS_CONSTANT_EVALUATED) + if (TEST_IS_CONSTANT_EVALUATED_CXX23) last = const_cast(std::from_chars(p, ep, r, base).ptr); else r = strtoull(p, &last, base); @@ -163,7 +163,7 @@ #ifndef TEST_HAS_NO_INT128 static TEST_CONSTEXPR_CXX23 __int128_t fromchars128_impl(char const* p, char const* ep, int base, true_type) { - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { char* last; __int128_t r = strtoll(p, &last, base); if(errno != ERANGE) { @@ -185,7 +185,7 @@ static TEST_CONSTEXPR_CXX23 __uint128_t fromchars128_impl(char const* p, char const* ep, int base, false_type) { - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) { char* last; __uint128_t r = strtoull(p, &last, base); if(errno != ERANGE) { Index: libcxx/test/support/constexpr_char_traits.h =================================================================== --- libcxx/test/support/constexpr_char_traits.h +++ libcxx/test/support/constexpr_char_traits.h @@ -121,7 +121,7 @@ TEST_CONSTEXPR_CXX14 CharT* constexpr_char_traits::copy(char_type* s1, const char_type* s2, std::size_t n) { - if (!TEST_IS_CONSTANT_EVALUATED) // fails in constexpr because we might be comparing unrelated pointers + if (!TEST_IS_CONSTANT_EVALUATED_CXX14) // fails in constexpr because we might be comparing unrelated pointers assert(s2 < s1 || s2 >= s1+n); char_type* r = s1; for (; n; --n, ++s1, ++s2) Index: libcxx/test/support/count_new.h =================================================================== --- libcxx/test/support/count_new.h +++ libcxx/test/support/count_new.h @@ -478,7 +478,7 @@ struct ConstexprDisableAllocationGuard { TEST_CONSTEXPR_CXX14 explicit ConstexprDisableAllocationGuard(bool disable = true) : m_disabled(disable) { - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX14) { // Don't re-disable if already disabled. if (globalMemCounter.disable_allocations == true) m_disabled = false; if (m_disabled) globalMemCounter.disableAllocations(); @@ -488,7 +488,7 @@ } TEST_CONSTEXPR_CXX14 void release() { - if (!TEST_IS_CONSTANT_EVALUATED) { + if (!TEST_IS_CONSTANT_EVALUATED_CXX14) { if (m_disabled) globalMemCounter.enableAllocations(); m_disabled = false; } Index: libcxx/test/support/test_macros.h =================================================================== --- libcxx/test/support/test_macros.h +++ libcxx/test/support/test_macros.h @@ -145,7 +145,7 @@ #if defined(__cpp_lib_is_constant_evaluated) && __cpp_lib_is_constant_evaluated >= 201811L # define TEST_IS_CONSTANT_EVALUATED std::is_constant_evaluated() -#elif TEST_HAS_BUILTIN(__builtin_is_constant_evaluated) +#elif TEST_HAS_BUILTIN(__builtin_is_constant_evaluated) && TEST_STD_VER >= 11 # define TEST_IS_CONSTANT_EVALUATED __builtin_is_constant_evaluated() #else # define TEST_IS_CONSTANT_EVALUATED false @@ -153,26 +153,34 @@ #if TEST_STD_VER >= 14 # define TEST_CONSTEXPR_CXX14 constexpr +# define TEST_IS_CONSTANT_EVALUATED_CXX14 TEST_IS_CONSTANT_EVALUATED #else # define TEST_CONSTEXPR_CXX14 +# define TEST_IS_CONSTANT_EVALUATED_CXX14 false #endif #if TEST_STD_VER >= 17 # define TEST_CONSTEXPR_CXX17 constexpr +# define TEST_IS_CONSTANT_EVALUATED_CXX17 TEST_IS_CONSTANT_EVALUATED #else # define TEST_CONSTEXPR_CXX17 +# define TEST_IS_CONSTANT_EVALUATED_CXX17 false #endif #if TEST_STD_VER >= 20 # define TEST_CONSTEXPR_CXX20 constexpr +# define TEST_IS_CONSTANT_EVALUATED_CXX20 TEST_IS_CONSTANT_EVALUATED #else # define TEST_CONSTEXPR_CXX20 +# define TEST_IS_CONSTANT_EVALUATED_CXX20 false #endif #if TEST_STD_VER >= 23 # define TEST_CONSTEXPR_CXX23 constexpr +# define TEST_IS_CONSTANT_EVALUATED_CXX23 TEST_IS_CONSTANT_EVALUATED #else # define TEST_CONSTEXPR_CXX23 +# define TEST_IS_CONSTANT_EVALUATED_CXX23 false #endif #define TEST_ALIGNAS_TYPE(...) TEST_ALIGNAS(TEST_ALIGNOF(__VA_ARGS__)) Index: libcxx/test/support/unique_ptr_test_helper.h =================================================================== --- libcxx/test/support/unique_ptr_test_helper.h +++ libcxx/test/support/unique_ptr_test_helper.h @@ -18,15 +18,15 @@ struct A { static int count; TEST_CONSTEXPR_CXX23 A() { - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) ++count; } TEST_CONSTEXPR_CXX23 A(const A&) { - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) ++count; } TEST_CONSTEXPR_CXX23 virtual ~A() { - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) --count; } }; @@ -36,15 +36,15 @@ struct B : public A { static int count; TEST_CONSTEXPR_CXX23 B() { - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) ++count; } TEST_CONSTEXPR_CXX23 B(const B& other) : A(other) { - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) ++count; } TEST_CONSTEXPR_CXX23 virtual ~B() { - if (!TEST_IS_CONSTANT_EVALUATED) + if (!TEST_IS_CONSTANT_EVALUATED_CXX23) --count; } };