-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Closed
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partyconstevalC++20 constevalC++20 constevalrejects-valid
Description
GCC test: g++.dg/cpp2a/consteval-defarg3.C
consteval int foober();
int g(int = foober());
struct A { int i = foober(); };
template <int i = foober()> struct B { };
struct C
{
consteval C(int = foober()) { }
};
int h(C = C());
consteval int foober() { return 42; }
int main() {
A a;
B<> b;
g();
h();
}
Diagnostic:
<source>:5:19: error: non-type template argument is not a constant expression
template <int i = foober()> struct B { };
^~~~~~~~
<source>:5:19: note: undefined function 'foober' cannot be used in a constant expression
<source>:1:15: note: declared here
consteval int foober();
^
<source>:16:3: error: too few template arguments for class template 'B'
B<> b;
^
<source>:5:36: note: template is declared here
template <int i = foober()> struct B { };
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partyconstevalC++20 constevalC++20 constevalrejects-valid
Type
Projects
Status
No status