xref: /llvm-project/libcxx/test/std/utilities/intseq/intseq.intseq/integer_seq.compile.fail.cpp (revision 7a6aaf9b23d6ac2fb8c11c00c73e55c0bc7aa2f0)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <utility>
10 
11 // template<class T, T... I>
12 // struct integer_sequence
13 // {
14 //     typedef T type;
15 //
16 //     static constexpr size_t size() noexcept;
17 // };
18 
19 // This test is a conforming extension.  The extension turns undefined behavior
20 //  into a compile-time error.
21 
22 #include <utility>
23 
24 #include "test_macros.h"
25 
26 int main(int, char**)
27 {
28 #if TEST_STD_VER > 11
29 
30 //  Should fail to compile, since float is not an integral type
31     using floatmix = std::integer_sequence<float>;
32     floatmix::value_type I;
33 
34 #else
35 
36 X
37 
38 #endif  // TEST_STD_VER > 11
39 
40   return 0;
41 }
42