Clang Project

clang_source_code/test/SemaCXX/cxx2a-user-defined-literals.cpp
1// RUN: %clang_cc1 -std=c++2a %s -include %s -verify
2
3#ifndef INCLUDED
4#define INCLUDED
5
6#pragma clang system_header
7namespace std {
8  namespace chrono {
9    struct day{};
10    struct year{};
11  }
12  constexpr chrono::day operator"" d(unsigned long long d) noexcept;
13  constexpr chrono::year operator"" y(unsigned long long y) noexcept;
14}
15
16#else
17
18using namespace std;
19chrono::day dec_d = 5d;
20chrono::day oct_d = 05d;
21chrono::day bin_d = 0b011d;
22// expected-error@+3{{no viable conversion from 'int' to 'chrono::day'}}
23// expected-note@9{{candidate constructor (the implicit copy constructor)}}
24// expected-note@9{{candidate constructor (the implicit move constructor)}}
25chrono::day hex_d = 0x44d;
26chrono::year y  = 10y;
27#endif
28