1a5728872c7702ddd09537c95bc3cbd20e1f2fb09Daniel Dunbar// RUN: %clang_cc1 -fsyntax-only -verify %s
265f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas Gregor
365f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas Gregorstruct NonDefaultConstructible {
4b1622a1fd7b7f4ab8d00d0183d17c90ad25c14e3John McCall  NonDefaultConstructible(const NonDefaultConstructible&); // expected-note{{candidate constructor}}
565f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas Gregor};
665f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas Gregor
765f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas Gregortemplate<typename T, typename U>
865f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas Gregorstruct X {
965f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas Gregor  static T member;
1065f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas Gregor};
1165f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas Gregor
1265f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas Gregortemplate<typename T, typename U>
1365f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas GregorT X<T, U>::member; // expected-error{{no matching constructor}}
1465f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas Gregor
1565f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas Gregor// Okay; this is a declaration, not a definition.
1665f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas Gregortemplate<>
1765f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas GregorNonDefaultConstructible X<NonDefaultConstructible, long>::member;
1865f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas Gregor
1965f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas GregorNonDefaultConstructible &test(bool b) {
2065f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas Gregor  return b? X<NonDefaultConstructible, int>::member // expected-note{{instantiation}}
2165f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas Gregor          : X<NonDefaultConstructible, long>::member;
2265f6642e88ac39f2c1129f9b92b3fafd55dc32dfDouglas Gregor}
23175c5bb2b09217df71319cb3d58b3c511fd04138Douglas Gregor
24175c5bb2b09217df71319cb3d58b3c511fd04138Douglas Gregornamespace rdar9422013 {
25175c5bb2b09217df71319cb3d58b3c511fd04138Douglas Gregor  template<int>
26175c5bb2b09217df71319cb3d58b3c511fd04138Douglas Gregor  struct X {
27175c5bb2b09217df71319cb3d58b3c511fd04138Douglas Gregor    struct Inner {
28175c5bb2b09217df71319cb3d58b3c511fd04138Douglas Gregor      static unsigned array[17];
29175c5bb2b09217df71319cb3d58b3c511fd04138Douglas Gregor    };
30175c5bb2b09217df71319cb3d58b3c511fd04138Douglas Gregor  };
31175c5bb2b09217df71319cb3d58b3c511fd04138Douglas Gregor
32175c5bb2b09217df71319cb3d58b3c511fd04138Douglas Gregor  template<> unsigned X<1>::Inner::array[]; // okay
33175c5bb2b09217df71319cb3d58b3c511fd04138Douglas Gregor}
34