Skip to content

Commit 0ed8935

Browse files
committed
Add tests for #66562
Fixes #66562
1 parent 12e04c8 commit 0ed8935

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

clang/test/SemaCXX/cxx2a-consteval.cpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ consteval int f1(int i) {
88
return i;
99
}
1010

11-
consteval constexpr int f2(int i) {
11+
consteval constexpr int f2(int i) {
1212
//expected-error@-1 {{cannot combine}}
1313
return i;
1414
}
@@ -195,7 +195,7 @@ auto ptr = ret1(0);
195195
struct A {
196196
consteval int f(int) {
197197
// expected-note@-1+ {{declared here}}
198-
return 0;
198+
return 0;
199199
}
200200
};
201201

@@ -239,7 +239,7 @@ constexpr int f_c(int i) {
239239
int t = f(i);
240240
// expected-error@-1 {{is not a constant expression}}
241241
// expected-note@-2 {{function parameter}}
242-
return f(0);
242+
return f(0);
243243
}
244244

245245
consteval int f_eval(int i) {
@@ -675,7 +675,7 @@ Bar<derp> a; // expected-note {{in instantiation of member function 'issue_55601
675675

676676
struct constantDerp {
677677
// Can be used in a constant expression.
678-
consteval constantDerp(int) {}
678+
consteval constantDerp(int) {}
679679
consteval operator int() const { return 5; }
680680
};
681681
Bar<constantDerp> b;
@@ -1162,3 +1162,17 @@ struct C {
11621162
};
11631163

11641164
}
1165+
1166+
namespace GH66562 {
1167+
1168+
namespace ns
1169+
{
1170+
consteval int foo(int x) { return 1; } // expected-note {{declared here}}
1171+
}
1172+
1173+
template <class A>
1174+
struct T {
1175+
static constexpr auto xx = ns::foo(A{}); // expected-error {{cannot take address of consteval function 'foo' outside of an immediate invocation}}
1176+
};
1177+
1178+
}

0 commit comments

Comments
 (0)