1 template<auto V> struct S {}; 2 3 S<15> v_int; 4 S<'p'> v_char; 5 // Not supported by Clang yet. 6 //S<4.2> v_double; 7 8 extern const int a; 9 S<&a> v_int_pointer; 10 11 const int b = 4; 12 const int& c = b; 13 S<c> v_int_reference; 14 15 extern void d(); 16 S<&d> v_function_pointer; 17 e()18void e() {} 19 void (&f)() = e; 20 S<f> v_function_reference; 21 22 struct H { 23 int i1; 24 int i2; 25 void j1(); 26 void j2(); 27 }; 28 S<&H::i2> v_pointer_to_member; 29 S<&H::j2> v_pointer_to_method; 30 31 enum class K { l }; 32 S<K::l> v_enumerator; 33 34 S<nullptr> v_nullptr; 35 36 // C++20 only. 37 //int m[2] = { 10, 4 }; 38 //S<&(m[1])> v_pointer_to_subobject; 39 40 // C++20 only and cannot appear in ABI anyway. 41 //S<[](){}> v_lambda; 42