Douglas Gregor | 171dcdb | 2010-10-13 18:27:55 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wconversion -verify %s |
Douglas Gregor | 6ae5e66 | 2009-02-10 23:36:10 +0000 | [diff] [blame] | 2 | template<int N> struct A; // expected-note 5{{template parameter is declared here}} |
Douglas Gregor | 8b64259 | 2009-02-10 00:53:15 +0000 | [diff] [blame] | 3 | |
| 4 | A<0> *a0; |
| 5 | |
Richard Smith | 4b6ebe3 | 2012-12-19 03:15:32 +0000 | [diff] [blame] | 6 | A<int()> *a1; // expected-error{{template argument for non-type template parameter is treated as function type 'int ()'}} |
Douglas Gregor | 8b64259 | 2009-02-10 00:53:15 +0000 | [diff] [blame] | 7 | |
Douglas Gregor | 39a8de1 | 2009-02-25 19:37:18 +0000 | [diff] [blame] | 8 | A<int> *a2; // expected-error{{template argument for non-type template parameter must be an expression}} |
Douglas Gregor | 8b64259 | 2009-02-10 00:53:15 +0000 | [diff] [blame] | 9 | |
Douglas Gregor | b3df138 | 2011-10-12 19:26:40 +0000 | [diff] [blame] | 10 | A<1 >> 2> *a3; // expected-warning{{use of right-shift operator ('>>') in template argument will require parentheses in C++11}} |
Douglas Gregor | 8b64259 | 2009-02-10 00:53:15 +0000 | [diff] [blame] | 11 | |
Douglas Gregor | 6ae5e66 | 2009-02-10 23:36:10 +0000 | [diff] [blame] | 12 | // C++ [temp.arg.nontype]p5: |
Douglas Gregor | 788cd06 | 2009-11-11 01:00:40 +0000 | [diff] [blame] | 13 | A<A> *a4; // expected-error{{must be an expression}} |
Douglas Gregor | 6ae5e66 | 2009-02-10 23:36:10 +0000 | [diff] [blame] | 14 | |
| 15 | enum E { Enumerator = 17 }; |
Douglas Gregor | 39a8de1 | 2009-02-25 19:37:18 +0000 | [diff] [blame] | 16 | A<E> *a5; // expected-error{{template argument for non-type template parameter must be an expression}} |
Douglas Gregor | 6ae5e66 | 2009-02-10 23:36:10 +0000 | [diff] [blame] | 17 | template<E Value> struct A1; // expected-note{{template parameter is declared here}} |
| 18 | A1<Enumerator> *a6; // okay |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame] | 19 | A1<17> *a7; // expected-error{{non-type template argument of type 'int' cannot be converted to a value of type 'E'}} |
Douglas Gregor | 6ae5e66 | 2009-02-10 23:36:10 +0000 | [diff] [blame] | 20 | |
| 21 | const long LongValue = 12345678; |
| 22 | A<LongValue> *a8; |
| 23 | const short ShortValue = 17; |
| 24 | A<ShortValue> *a9; |
| 25 | |
| 26 | int f(int); |
Douglas Gregor | 39a8de1 | 2009-02-25 19:37:18 +0000 | [diff] [blame] | 27 | A<f(17)> *a10; // expected-error{{non-type template argument of type 'int' is not an integral constant expression}} |
Douglas Gregor | 6ae5e66 | 2009-02-10 23:36:10 +0000 | [diff] [blame] | 28 | |
| 29 | class X { |
| 30 | public: |
Douglas Gregor | a35284b | 2009-02-11 00:19:33 +0000 | [diff] [blame] | 31 | X(); |
Douglas Gregor | 6ae5e66 | 2009-02-10 23:36:10 +0000 | [diff] [blame] | 32 | X(int, int); |
| 33 | operator int() const; |
| 34 | }; |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame] | 35 | A<X(17, 42)> *a11; // expected-error{{non-type template argument of type 'X' must have an integral or enumeration type}} |
Douglas Gregor | a35284b | 2009-02-11 00:19:33 +0000 | [diff] [blame] | 36 | |
Douglas Gregor | a35284b | 2009-02-11 00:19:33 +0000 | [diff] [blame] | 37 | float f(float); |
| 38 | |
Douglas Gregor | 1a8cf73 | 2010-04-14 23:11:21 +0000 | [diff] [blame] | 39 | float g(float); // expected-note 2{{candidate function}} |
| 40 | double g(double); // expected-note 2{{candidate function}} |
Douglas Gregor | a35284b | 2009-02-11 00:19:33 +0000 | [diff] [blame] | 41 | |
| 42 | int h(int); |
| 43 | float h2(float); |
| 44 | |
Douglas Gregor | 1a8cf73 | 2010-04-14 23:11:21 +0000 | [diff] [blame] | 45 | template<int fp(int)> struct A3; // expected-note 1{{template parameter is declared here}} |
Douglas Gregor | a35284b | 2009-02-11 00:19:33 +0000 | [diff] [blame] | 46 | A3<h> *a14_1; |
| 47 | A3<&h> *a14_2; |
| 48 | A3<f> *a14_3; |
| 49 | A3<&f> *a14_4; |
Douglas Gregor | b7a0926 | 2010-04-01 18:32:35 +0000 | [diff] [blame] | 50 | A3<h2> *a14_6; // expected-error{{non-type template argument of type 'float (float)' cannot be converted to a value of type 'int (*)(int)'}} |
Douglas Gregor | 1a8cf73 | 2010-04-14 23:11:21 +0000 | [diff] [blame] | 51 | A3<g> *a14_7; // expected-error{{address of overloaded function 'g' does not match required type 'int (int)'}} |
Douglas Gregor | f684e6e | 2009-02-11 00:44:29 +0000 | [diff] [blame] | 52 | |
| 53 | |
| 54 | struct Y { } y; |
| 55 | |
| 56 | volatile X * X_volatile_ptr; |
| 57 | template<X const &AnX> struct A4; // expected-note 2{{template parameter is declared here}} |
Douglas Gregor | 86a7625 | 2010-02-04 17:21:48 +0000 | [diff] [blame] | 58 | X an_X; |
Douglas Gregor | cc45cb3 | 2009-02-11 19:52:55 +0000 | [diff] [blame] | 59 | A4<an_X> *a15_1; // okay |
Douglas Gregor | b7a0926 | 2010-04-01 18:32:35 +0000 | [diff] [blame] | 60 | A4<*X_volatile_ptr> *a15_2; // expected-error{{non-type template argument does not refer to any declaration}} |
Chris Lattner | 0c42bb6 | 2010-09-05 00:17:29 +0000 | [diff] [blame] | 61 | A4<y> *15_3; // expected-error{{non-type template parameter of reference type 'const X &' cannot bind to template argument of type 'struct Y'}} \ |
Douglas Gregor | 39a8de1 | 2009-02-25 19:37:18 +0000 | [diff] [blame] | 62 | // FIXME: expected-error{{expected unqualified-id}} |
Douglas Gregor | f684e6e | 2009-02-11 00:44:29 +0000 | [diff] [blame] | 63 | |
Douglas Gregor | 1a8cf73 | 2010-04-14 23:11:21 +0000 | [diff] [blame] | 64 | template<int (&fr)(int)> struct A5; // expected-note{{template parameter is declared here}} |
Douglas Gregor | b86b057 | 2009-02-11 01:18:59 +0000 | [diff] [blame] | 65 | A5<h> *a16_1; |
Douglas Gregor | b86b057 | 2009-02-11 01:18:59 +0000 | [diff] [blame] | 66 | A5<f> *a16_3; |
Douglas Gregor | b7a0926 | 2010-04-01 18:32:35 +0000 | [diff] [blame] | 67 | A5<h2> *a16_6; // expected-error{{non-type template parameter of reference type 'int (&)(int)' cannot bind to template argument of type 'float (float)'}} |
Douglas Gregor | 1a8cf73 | 2010-04-14 23:11:21 +0000 | [diff] [blame] | 68 | A5<g> *a14_7; // expected-error{{address of overloaded function 'g' does not match required type 'int (int)'}} |
Douglas Gregor | b86b057 | 2009-02-11 01:18:59 +0000 | [diff] [blame] | 69 | |
| 70 | struct Z { |
| 71 | int foo(int); |
| 72 | float bar(float); |
| 73 | int bar(int); |
| 74 | double baz(double); |
Douglas Gregor | 658bbb5 | 2009-02-11 16:16:59 +0000 | [diff] [blame] | 75 | |
| 76 | int int_member; |
| 77 | float float_member; |
David Majnemer | 255ca71 | 2013-10-22 21:56:38 +0000 | [diff] [blame] | 78 | union { |
| 79 | int union_member; |
| 80 | }; |
Douglas Gregor | b86b057 | 2009-02-11 01:18:59 +0000 | [diff] [blame] | 81 | }; |
| 82 | template<int (Z::*pmf)(int)> struct A6; // expected-note{{template parameter is declared here}} |
| 83 | A6<&Z::foo> *a17_1; |
| 84 | A6<&Z::bar> *a17_2; |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 85 | A6<&Z::baz> *a17_3; // expected-error-re{{non-type template argument of type 'double (Z::*)(double){{( __attribute__\(\(thiscall\)\))?}}' cannot be converted to a value of type 'int (Z::*)(int){{( __attribute__\(\(thiscall\)\))?}}'}} |
Douglas Gregor | 658bbb5 | 2009-02-11 16:16:59 +0000 | [diff] [blame] | 86 | |
| 87 | |
| 88 | template<int Z::*pm> struct A7; // expected-note{{template parameter is declared here}} |
| 89 | template<int Z::*pm> struct A7c; |
| 90 | A7<&Z::int_member> *a18_1; |
| 91 | A7c<&Z::int_member> *a18_2; |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame] | 92 | A7<&Z::float_member> *a18_3; // expected-error{{non-type template argument of type 'float Z::*' cannot be converted to a value of type 'int Z::*'}} |
Abramo Bagnara | 2c5399f | 2010-09-13 06:06:58 +0000 | [diff] [blame] | 93 | A7c<(&Z::int_member)> *a18_4; // expected-warning{{address non-type template argument cannot be surrounded by parentheses}} |
David Majnemer | 255ca71 | 2013-10-22 21:56:38 +0000 | [diff] [blame] | 94 | A7c<&Z::union_member> *a18_5; |
Douglas Gregor | f80a9d5 | 2009-03-14 00:20:21 +0000 | [diff] [blame] | 95 | |
| 96 | template<unsigned char C> struct Overflow; // expected-note{{template parameter is declared here}} |
| 97 | |
| 98 | Overflow<5> *overflow1; // okay |
Eli Friedman | 29f89f6 | 2009-12-23 18:44:58 +0000 | [diff] [blame] | 99 | Overflow<255> *overflow2; // okay |
Douglas Gregor | 1a6e034 | 2010-03-26 02:38:37 +0000 | [diff] [blame] | 100 | Overflow<256> *overflow3; // expected-warning{{non-type template argument value '256' truncated to '0' for template parameter of type 'unsigned char'}} |
Douglas Gregor | f80a9d5 | 2009-03-14 00:20:21 +0000 | [diff] [blame] | 101 | |
| 102 | |
| 103 | template<unsigned> struct Signedness; // expected-note{{template parameter is declared here}} |
| 104 | Signedness<10> *signedness1; // okay |
Douglas Gregor | 1a6e034 | 2010-03-26 02:38:37 +0000 | [diff] [blame] | 105 | Signedness<-10> *signedness2; // expected-warning{{non-type template argument with value '-10' converted to '4294967286' for unsigned template parameter of type 'unsigned int'}} |
Douglas Gregor | 0408678 | 2009-05-11 16:52:38 +0000 | [diff] [blame] | 106 | |
Eli Friedman | 29f89f6 | 2009-12-23 18:44:58 +0000 | [diff] [blame] | 107 | template<signed char C> struct SignedOverflow; // expected-note 3 {{template parameter is declared here}} |
| 108 | SignedOverflow<1> *signedoverflow1; |
| 109 | SignedOverflow<-1> *signedoverflow2; |
| 110 | SignedOverflow<-128> *signedoverflow3; |
Douglas Gregor | 1a6e034 | 2010-03-26 02:38:37 +0000 | [diff] [blame] | 111 | SignedOverflow<-129> *signedoverflow4; // expected-warning{{non-type template argument value '-129' truncated to '127' for template parameter of type 'signed char'}} |
Eli Friedman | 29f89f6 | 2009-12-23 18:44:58 +0000 | [diff] [blame] | 112 | SignedOverflow<127> *signedoverflow5; |
Douglas Gregor | 1a6e034 | 2010-03-26 02:38:37 +0000 | [diff] [blame] | 113 | SignedOverflow<128> *signedoverflow6; // expected-warning{{non-type template argument value '128' truncated to '-128' for template parameter of type 'signed char'}} |
| 114 | SignedOverflow<(unsigned char)128> *signedoverflow7; // expected-warning{{non-type template argument value '128' truncated to '-128' for template parameter of type 'signed char'}} |
Eli Friedman | 29f89f6 | 2009-12-23 18:44:58 +0000 | [diff] [blame] | 115 | |
Douglas Gregor | 0408678 | 2009-05-11 16:52:38 +0000 | [diff] [blame] | 116 | // Check canonicalization of template arguments. |
| 117 | template<int (*)(int, int)> struct FuncPtr0; |
| 118 | int func0(int, int); |
| 119 | extern FuncPtr0<&func0> *fp0; |
| 120 | template<int (*)(int, int)> struct FuncPtr0; |
| 121 | extern FuncPtr0<&func0> *fp0; |
| 122 | int func0(int, int); |
| 123 | extern FuncPtr0<&func0> *fp0; |
| 124 | |
Douglas Gregor | 8623541 | 2009-11-04 18:18:19 +0000 | [diff] [blame] | 125 | // PR5350 |
| 126 | namespace ns { |
| 127 | template <typename T> |
| 128 | struct Foo { |
| 129 | static const bool value = true; |
| 130 | }; |
| 131 | |
| 132 | template <bool b> |
| 133 | struct Bar {}; |
| 134 | |
| 135 | const bool value = false; |
| 136 | |
| 137 | Bar<bool(ns::Foo<int>::value)> x; |
| 138 | } |
Douglas Gregor | ff52439 | 2009-11-04 21:50:46 +0000 | [diff] [blame] | 139 | |
| 140 | // PR5349 |
| 141 | namespace ns { |
| 142 | enum E { k }; |
| 143 | |
| 144 | template <E e> |
| 145 | struct Baz {}; |
| 146 | |
| 147 | Baz<k> f1; // This works. |
| 148 | Baz<E(0)> f2; // This too. |
| 149 | Baz<static_cast<E>(0)> f3; // And this. |
| 150 | |
| 151 | Baz<ns::E(0)> b1; // This doesn't work. |
| 152 | Baz<static_cast<ns::E>(0)> b2; // This neither. |
| 153 | } |
| 154 | |
Douglas Gregor | d85b5b9 | 2009-11-25 22:24:25 +0000 | [diff] [blame] | 155 | // PR5597 |
| 156 | template<int (*)(float)> struct X0 { }; |
| 157 | |
| 158 | struct X1 { |
| 159 | static int pfunc(float); |
| 160 | }; |
| 161 | void test_X0_X1() { |
| 162 | X0<X1::pfunc> x01; |
| 163 | } |
John McCall | 645cf44 | 2010-02-06 10:23:53 +0000 | [diff] [blame] | 164 | |
| 165 | // PR6249 |
| 166 | namespace pr6249 { |
| 167 | template<typename T, T (*func)()> T f() { |
| 168 | return func(); |
| 169 | } |
| 170 | |
| 171 | int h(); |
| 172 | template int f<int, h>(); |
| 173 | } |
Douglas Gregor | 02024a9 | 2010-03-28 02:42:43 +0000 | [diff] [blame] | 174 | |
| 175 | namespace PR6723 { |
Douglas Gregor | a009b59 | 2011-01-07 00:20:55 +0000 | [diff] [blame] | 176 | template<unsigned char C> void f(int (&a)[C]); // expected-note {{candidate template ignored}} \ |
Douglas Gregor | 5fad9b8 | 2011-10-12 20:35:48 +0000 | [diff] [blame] | 177 | // expected-note{{substitution failure [with C = '\x00']}} |
Douglas Gregor | 02024a9 | 2010-03-28 02:42:43 +0000 | [diff] [blame] | 178 | void g() { |
| 179 | int arr512[512]; |
| 180 | f(arr512); // expected-error{{no matching function for call}} |
| 181 | f<512>(arr512); // expected-error{{no matching function for call}} |
| 182 | } |
| 183 | } |
Douglas Gregor | 77c13e0 | 2010-04-24 18:20:53 +0000 | [diff] [blame] | 184 | |
| 185 | // Check that we instantiate declarations whose addresses are taken |
| 186 | // for non-type template arguments. |
| 187 | namespace EntityReferenced { |
| 188 | template<typename T, void (*)(T)> struct X { }; |
| 189 | |
| 190 | template<typename T> |
| 191 | struct Y { |
| 192 | static void f(T x) { |
| 193 | x = 1; // expected-error{{assigning to 'int *' from incompatible type 'int'}} |
| 194 | } |
| 195 | }; |
| 196 | |
| 197 | void g() { |
| 198 | typedef X<int*, Y<int*>::f> x; // expected-note{{in instantiation of}} |
| 199 | } |
| 200 | } |
Douglas Gregor | 77e2c67 | 2010-04-29 04:55:13 +0000 | [diff] [blame] | 201 | |
| 202 | namespace PR6964 { |
| 203 | template <typename ,int, int = 9223372036854775807L > // expected-warning 2{{non-type template argument value '9223372036854775807' truncated to '-1' for template parameter of type 'int'}} \ |
| 204 | // expected-note 2{{template parameter is declared here}} |
| 205 | struct as_nview { }; |
| 206 | |
| 207 | template <typename Sequence, int I0> |
| 208 | struct as_nview<Sequence, I0> // expected-note{{while checking a default template argument used here}} |
| 209 | { }; |
| 210 | } |
John McCall | 7667245 | 2010-08-19 23:06:02 +0000 | [diff] [blame] | 211 | |
| 212 | // rdar://problem/8302138 |
| 213 | namespace test8 { |
| 214 | template <int* ip> struct A { |
| 215 | int* p; |
| 216 | A() : p(ip) {} |
| 217 | }; |
| 218 | |
| 219 | void test0() { |
| 220 | extern int i00; |
| 221 | A<&i00> a00; |
| 222 | } |
| 223 | |
| 224 | extern int i01; |
| 225 | void test1() { |
| 226 | A<&i01> a01; |
| 227 | } |
| 228 | |
| 229 | |
| 230 | struct C { |
| 231 | int x; |
| 232 | char y; |
| 233 | double z; |
| 234 | }; |
| 235 | |
| 236 | template <C* cp> struct B { |
| 237 | C* p; |
| 238 | B() : p(cp) {} |
| 239 | }; |
| 240 | |
| 241 | void test2() { |
| 242 | extern C c02; |
| 243 | B<&c02> b02; |
| 244 | } |
| 245 | |
| 246 | extern C c03; |
| 247 | void test3() { |
| 248 | B<&c03> b03; |
| 249 | } |
| 250 | } |
Douglas Gregor | b535041 | 2010-10-13 17:22:14 +0000 | [diff] [blame] | 251 | |
| 252 | namespace PR8372 { |
| 253 | template <int I> void foo() { } // expected-note{{template parameter is declared here}} |
| 254 | void bar() { foo <0x80000000> (); } // expected-warning{{non-type template argument value '2147483648' truncated to '-2147483648' for template parameter of type 'int'}} |
| 255 | } |
Chandler Carruth | 781701c | 2011-02-19 00:21:00 +0000 | [diff] [blame] | 256 | |
| 257 | namespace PR9227 { |
| 258 | template <bool B> struct enable_if_bool { }; |
Kaelyn Uhrain | b5c7768 | 2013-10-19 00:05:00 +0000 | [diff] [blame] | 259 | template <> struct enable_if_bool<true> { typedef int type; }; // expected-note{{'enable_if_bool<true>::type' declared here}} |
| 260 | void test_bool() { enable_if_bool<false>::type i; } // expected-error{{enable_if_bool<false>'; did you mean 'enable_if_bool<true>::type'?}} |
Chandler Carruth | 781701c | 2011-02-19 00:21:00 +0000 | [diff] [blame] | 261 | |
| 262 | template <char C> struct enable_if_char { }; |
Kaelyn Uhrain | b5c7768 | 2013-10-19 00:05:00 +0000 | [diff] [blame] | 263 | template <> struct enable_if_char<'a'> { typedef int type; }; // expected-note 5{{'enable_if_char<'a'>::type' declared here}} |
| 264 | void test_char_0() { enable_if_char<0>::type i; } // expected-error{{enable_if_char<'\x00'>'; did you mean 'enable_if_char<'a'>::type'?}} |
| 265 | void test_char_b() { enable_if_char<'b'>::type i; } // expected-error{{enable_if_char<'b'>'; did you mean 'enable_if_char<'a'>::type'?}} |
| 266 | void test_char_possibly_negative() { enable_if_char<'\x02'>::type i; } // expected-error{{enable_if_char<'\x02'>'; did you mean 'enable_if_char<'a'>::type'?}} |
| 267 | void test_char_single_quote() { enable_if_char<'\''>::type i; } // expected-error{{enable_if_char<'\''>'; did you mean 'enable_if_char<'a'>::type'?}} |
| 268 | void test_char_backslash() { enable_if_char<'\\'>::type i; } // expected-error{{enable_if_char<'\\'>'; did you mean 'enable_if_char<'a'>::type'?}} |
Chandler Carruth | 781701c | 2011-02-19 00:21:00 +0000 | [diff] [blame] | 269 | } |
Douglas Gregor | 6b63f55 | 2011-08-09 01:55:14 +0000 | [diff] [blame] | 270 | |
| 271 | namespace PR10579 { |
| 272 | namespace fcppt |
| 273 | { |
| 274 | namespace container |
| 275 | { |
| 276 | namespace bitfield |
| 277 | { |
| 278 | |
| 279 | template< |
| 280 | typename Enum, |
| 281 | Enum Size |
| 282 | > |
| 283 | class basic; |
| 284 | |
| 285 | template< |
| 286 | typename Enum, |
| 287 | Enum Size |
| 288 | > |
| 289 | class basic |
| 290 | { |
| 291 | public: |
| 292 | basic() |
| 293 | { |
| 294 | } |
| 295 | }; |
| 296 | |
| 297 | } |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | namespace |
| 302 | { |
| 303 | |
| 304 | namespace testenum |
| 305 | { |
| 306 | enum type |
| 307 | { |
| 308 | foo, |
| 309 | bar, |
| 310 | size |
| 311 | }; |
| 312 | } |
| 313 | |
| 314 | } |
| 315 | |
| 316 | int main() |
| 317 | { |
| 318 | typedef fcppt::container::bitfield::basic< |
| 319 | testenum::type, |
| 320 | testenum::size |
| 321 | > bitfield_foo; |
| 322 | |
| 323 | bitfield_foo obj; |
| 324 | } |
| 325 | |
| 326 | } |
Eli Friedman | 7b2f51c | 2011-08-26 20:28:17 +0000 | [diff] [blame] | 327 | |
| 328 | template <int& I> struct PR10766 { static int *ip; }; |
| 329 | template <int& I> int* PR10766<I>::ip = &I; |
Douglas Gregor | b9df75f | 2013-01-16 00:52:15 +0000 | [diff] [blame] | 330 | |
| 331 | namespace rdar13000548 { |
David Blaikie | 98b879a | 2013-02-27 22:10:37 +0000 | [diff] [blame] | 332 | template<typename R, typename U, R F> |
| 333 | U f() { return &F; } // expected-error{{cannot take the address of an rvalue of type 'int (*)(int)'}} expected-error{{cannot take the address of an rvalue of type 'int *'}} |
Douglas Gregor | b9df75f | 2013-01-16 00:52:15 +0000 | [diff] [blame] | 334 | |
| 335 | int g(int); |
David Blaikie | 98b879a | 2013-02-27 22:10:37 +0000 | [diff] [blame] | 336 | int y[3]; |
Douglas Gregor | b9df75f | 2013-01-16 00:52:15 +0000 | [diff] [blame] | 337 | void test() |
| 338 | { |
David Blaikie | 98b879a | 2013-02-27 22:10:37 +0000 | [diff] [blame] | 339 | f<int(int), int (*)(int), g>(); // expected-note{{in instantiation of}} |
| 340 | f<int[3], int*, y>(); // expected-note{{in instantiation of}} |
Douglas Gregor | b9df75f | 2013-01-16 00:52:15 +0000 | [diff] [blame] | 341 | } |
| 342 | |
| 343 | } |
Douglas Gregor | 79bef7a | 2013-05-03 23:44:54 +0000 | [diff] [blame] | 344 | |
| 345 | namespace rdar13806270 { |
| 346 | template <unsigned N> class X { }; |
| 347 | const unsigned value = 32; |
| 348 | struct Y { |
| 349 | X<value + 1> x; |
| 350 | }; |
| 351 | void foo() {} |
| 352 | } |
David Majnemer | d7b4855 | 2013-10-26 05:02:13 +0000 | [diff] [blame] | 353 | |
| 354 | namespace PR17696 { |
| 355 | struct a { |
| 356 | union { |
| 357 | int i; |
| 358 | }; |
| 359 | }; |
| 360 | |
| 361 | template <int (a::*p)> struct b : a { |
| 362 | b() { this->*p = 0; } |
| 363 | }; |
| 364 | |
| 365 | b<&a::i> c; // okay |
| 366 | } |