-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"constevalC++20 constevalC++20 constevalconstexprAnything related to constant evaluationAnything related to constant evaluationperformancequality-of-implementation
Description
It seems that immediate invocations in constexpr initailizers are evaluated twice, once on evaluating the decl, and again on Sema::HandleImmediateInvocations (this doesn't happen if the var is within a consteval function). Strictly speaking, not a defect, but it's kinda wasteful?
consteval int foo(int* b) {
return *b; // Evaluation errors are emitted twice
}
constexpr int a = foo(nullptr);
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"constevalC++20 constevalC++20 constevalconstexprAnything related to constant evaluationAnything related to constant evaluationperformancequality-of-implementation