blob: 1efb364a1b271340fc0a70854d0a4e3e4e773028 [file] [log] [blame]
Douglas Gregor58944ac2009-05-31 09:31:02 +00001// RUN: clang-cc -fsyntax-only -verify %s
2template<typename T>
3struct is_pointer {
4 static const bool value = false;
5};
6
7template<typename T>
8struct is_pointer<T*> {
9 static const bool value = true;
10};
11
12template<typename T>
13struct is_pointer<const T*> {
14 static const bool value = true;
15};
16
17int array0[is_pointer<int>::value? -1 : 1];
18int array1[is_pointer<int*>::value? 1 : -1];
19int array2[is_pointer<const int*>::value? 1 : -1]; // expected-error{{partial ordering}} \
20// expected-error{{negative}}
Douglas Gregorbf23a8a2009-06-04 00:03:07 +000021
22template<typename T, typename U>
23struct is_same {
24 static const bool value = false;
25};
26
27template<typename T>
28struct is_same<T, T> {
29 static const bool value = true;
30};
31
32typedef int INT;
33typedef INT* int_ptr;
34
35int is_same0[is_same<int, int>::value? 1 : -1];
36int is_same1[is_same<int, INT>::value? 1 : -1];
37int is_same2[is_same<const int, int>::value? -1 : 1];
38int is_same3[is_same<int_ptr, int>::value? -1 : 1];