blob: 97ea6cbb8e533a1d5a05a8e2bc7432dc821eb9cf [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
Anders Carlsson76b1c842009-03-15 20:12:13 +00002
3#ifndef __GXX_EXPERIMENTAL_CXX0X__
4#define __CONCAT(__X, __Y) __CONCAT1(__X, __Y)
5#define __CONCAT1(__X, __Y) __X ## __Y
6
7#define static_assert(__b, __m) \
8 typedef int __CONCAT(__sa, __LINE__)[__b ? 1 : -1]
9#endif
10
11template <int N> class IntArray {
12 int elems[N];
13};
14
15static_assert(sizeof(IntArray<10>) == sizeof(int) * 10, "Array size mismatch");
16static_assert(sizeof(IntArray<1>) == sizeof(int) * 1, "Array size mismatch");
17
18template <typename T> class TenElementArray {
19 int elems[10];
20};
21
22static_assert(sizeof(TenElementArray<int>) == sizeof(int) * 10, "Array size mismatch");
23
24template<typename T, int N> class Array {
25 T elems[N];
26};
27
28static_assert(sizeof(Array<int, 10>) == sizeof(int) * 10, "Array size mismatch");