74 lines · c
1template<typename T> struct SomeTemplate {};2 3struct DefinedInCommon {4 void f();5 struct Inner {};6 friend void FoundByADL(DefinedInCommon);7};8 9template<typename T> struct CommonTemplate {10 enum E { a = 1, b = 2, c = 3 };11};12 13namespace Std {14 template<typename T> struct WithFriend {15 friend bool operator!=(const WithFriend &A, const WithFriend &B) { return false; }16 };17}18 19namespace Std {20 template<typename T> void f() {21 extern T g();22 }23}24 25template<typename T> struct TemplateInstantiationVisibility { typedef int type; };26 27template<typename T> struct Outer {28 template<typename U> struct Inner {29 static constexpr int f();30 static constexpr int g();31 };32};33 34template<typename T> struct WithPartialSpecialization {};35template<typename T> struct WithPartialSpecialization<void(T)> { typedef int type; };36typedef WithPartialSpecialization<int*> WithPartialSpecializationUse;37typedef WithPartialSpecialization<void(int)> WithPartialSpecializationUse2;38 39template<typename T> struct WithExplicitSpecialization;40typedef WithExplicitSpecialization<int> WithExplicitSpecializationUse;41 42template<typename T> struct WithImplicitSpecialMembers { int n; };43 44template<typename T> struct WithAliasTemplate {45 template<typename> using X = T;46};47 48template<typename T> struct WithAnonymousDecls {49 struct { bool k; };50 union { int a, b; };51 struct { int c, d; } s;52 enum { e = 123 };53 typedef int X;54};55 56namespace hidden_specializations {57 template<typename T> void fn() {}58 59 template<typename T> struct cls {60 static void nested_fn() {}61 struct nested_cls {};62 static int nested_var;63 enum class nested_enum {};64 65 template<typename U> static void nested_fn_t() {}66 template<typename U> struct nested_cls_t {};67 template<typename U> static int nested_var_t;68 };69 70 template<typename T> int var;71}72 73#include "cxx-templates-textual.h"74