Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/udlit-class-nttp-ctad-neg.C

raw
1 // PR c++/88095
2 // Test class non-type template parameters for literal operator templates.
3 // Validate handling of failed class template argument deduction.
4 // { dg-do compile { target c++20 } }
5
6 namespace std {
7 using size_t = decltype(sizeof(int));
8 }
9
10 template <typename CharT, std::size_t N>
11 struct fixed_string {
12 constexpr static std::size_t length = N;
13 constexpr fixed_string(...) { }
14 // auto operator<=> (const fixed_string&) = default;
15 };
16 // Missing deduction guide.
17
18 template <fixed_string fs>
19 constexpr std::size_t operator ""_udl() {
20 return decltype(fs)::length;
21 }
22
23 static_assert("test"_udl == 5); // { dg-error "15:no matching function for call to" }
24 // { dg-error "15:class template argument deduction failed" "" { target *-*-* } .-1 }