1 // RUN: %clang_cc1 -std=c++23 -triple x86_64-linux -Wpre-c++23-compat -fsyntax-only -verify=cxx23 %s
2 // RUN: %clang_cc1 -std=c++20 -triple x86_64-linux -fsyntax-only -verify=cxx20 %s
3 // RUN: %clang_cc1 -std=c++23 -triple i686-linux -fsyntax-only -verify=cxx23-32 %s
4 // RUN: %clang_cc1 -x c -std=c11 -fsyntax-only -verify=c11 %s
8 typedef __SIZE_TYPE__
size_t;
9 // Assume ptrdiff_t is the signed integer type corresponding to size_t.
10 typedef __PTRDIFF_TYPE__ ssize_t
;
12 template <typename
, typename
>
13 struct is_same
{ static constexpr bool value
= false; };
16 struct is_same
<T
, T
> { static constexpr bool value
= true; };
20 // cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
21 // cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
22 static_assert(is_same
<decltype(a1
), ssize_t
>::value
);
25 // cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
26 // cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
27 static_assert(is_same
<decltype(a2
), ssize_t
>::value
);
32 // cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
33 // cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
34 static_assert(is_same
<decltype(a1
), size_t>::value
);
37 // cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
38 // cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
39 static_assert(is_same
<decltype(a2
), size_t>::value
);
42 // cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
43 // cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
44 static_assert(is_same
<decltype(a3
), size_t>::value
);
47 // cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
48 // cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
49 static_assert(is_same
<decltype(a4
), size_t>::value
);
52 // cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
53 // cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
54 static_assert(is_same
<decltype(a5
), size_t>::value
);
57 // cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
58 // cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
59 static_assert(is_same
<decltype(a6
), size_t>::value
);
62 // cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
63 // cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
64 static_assert(is_same
<decltype(a7
), size_t>::value
);
67 // cxx23-warning@-1 {{'size_t' suffix for literals is incompatible with C++ standards before C++23}}
68 // cxx20-warning@-2 {{'size_t' suffix for literals is a C++23 extension}}
69 static_assert(is_same
<decltype(a8
), size_t>::value
);
74 (void)3'000'000'000z
; // cxx23-32-error {{signed 'size_t' literal is out of range of possible signed 'size_t' values}}
75 (void)3'000'000'000uz
;
76 (void)5'000'000'000uz
; // cxx23-32-error {{'size_t' literal is out of range of possible 'size_t' values}}
80 (void)0x180000000uz
; //cxx23-32-error {{'size_t' literal is out of range of possible 'size_t' values}}
87 (void)1z
; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
88 (void)1Z
; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
89 (void)1uz
; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
90 (void)1uZ
; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
91 (void)1Uz
; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
92 (void)1UZ
; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
93 (void)1zu
; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
94 (void)1Zu
; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
95 (void)1zU
; // c11-error {{'size_t' suffix for literals is a C++23 feature}}
96 (void)1ZU
; // c11-error {{'size_t' suffix for literals is a C++23 feature}}