Debian Codegraph @

gcc/testsuite/g++.dg/diagnostic/pr65923.C

raw
1 // { dg-do compile { target c++14 } }
2 // { dg-skip-if "requires hosted libstdc++ for chrono" { ! hostedlib } }
3
4 #include <chrono>
5
6 using std::literals::chrono_literals::operator""s;
7
8 struct X
9 {
10 friend constexpr std::chrono::duration<long double> std::literals::chrono_literals::operator""s(long double);
11 };
12
13 struct X2
14 {
15 friend constexpr X operator""foo(long double) {return {};} // { dg-warning "literal operator suffixes not preceded" }
16 };
17
18 namespace std
19 {
20 template<> void swap(X&, X&) noexcept
21 {
22 constexpr std::chrono::duration<long double> operator""s(long double);
23 }
24 }