Debian Codegraph @

gcc/testsuite/g++.dg/concepts/abbrev9.C

raw
1 // { dg-do compile { target concepts } }
2
3 template <class T, class U> concept same_as = __is_same(T, U);
4
5 same_as<int> auto f(auto, auto y) {
6 return y; // { dg-error "deduced return type" }
7 }
8
9 template <class>
10 struct A {
11 static auto g(auto x, auto y) -> same_as<decltype(x)> auto {
12 return y; // { dg-error "deduced return type" }
13 }
14 };
15
16 int main() {
17 f(0, 0); // { dg-bogus "" }
18 f("", 0); // { dg-bogus "" }
19 f(0, ""); // { dg-message "required from here" }
20 f("", ""); // { dg-message "required from here" }
21
22 A<void>::g(0, 0); // { dg-bogus "" }
23 A<void>::g("", 0); // { dg-message "required from here" }
24 A<void>::g(0, ""); // { dg-message "required from here" }
25 A<void>::g("", ""); // { dg-bogus "" }
26 }