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