1 // RUN: %clang_cc1 -fsyntax-only -verify %s
10 static enum K1
{ K1Val
= sizeof(T
) } Kind1
;
11 static enum { K2Val
= sizeof(T
)*2 } Kind2
;
12 enum { K3Val
= sizeof(T
)*2 } Kind3
;
17 Outer::Inner::InnerTemplate
<type
>::VeryInner::Kind2
= K2Val
;
25 Outer::Inner::InnerTemplate
<type
>::VeryInner::Kind2
= K2Val
;
28 InnerTemplate
<type
> t2
;
38 template struct N::Outer::Inner::InnerTemplate
<INT
>::VeryInner
;
39 template struct N::Outer::Inner::InnerTemplate
<INT
>::UeberInner
; // expected-error{{no struct named 'UeberInner' in 'N::Outer::Inner::InnerTemplate<int>'}}
43 template<typename T
, typename U
= T
>
46 enum { K1Val
= sizeof(T
) } k1
;
47 enum K2
{ K2Val
= sizeof(T
)*2 } k2a
;
51 struct S
{ T x
, y
; } s1
;
52 struct { U x
, y
; } s2
;
53 s1
.x
= s2
.x
; // expected-error{{incompatible}}
58 typedef struct { T z
; } type2
;
70 template struct N2::Outer2::Inner
<float>;
71 template struct N2::Outer2::Inner
<int*, float*>; // expected-note{{instantiation}}
73 // Test dependent pointer-to-member expressions.
80 operator int safe_bool::*() const {
81 return ptr
? &safe_bool::member
: 0;
87 void test_smart_ptr(smart_ptr
<int> p
) {
93 template <int K
> struct X
{
94 X() { extern void x(); }
100 template <typename T
> void f(T
const &t
) {
101 union { char c
; T t_
; };
102 c
= 'a'; // <- this shouldn't silently fail to instantiate
103 T::foo(); // expected-error {{has no members}}
105 template void f(int const &); // expected-note {{requested here}}
109 template<typename T
> void f() {
110 T::error
; // expected-error {{no member}}
113 // This counts as an odr-use, so should trigger the instantiation of f<int>.
114 (void)&f
<int>; // expected-note {{here}}