Debian Codegraph @

gcc/testsuite/g++.dg/cpp1y/69098.C

raw
1 // PR c++/69098
2 // { dg-do compile { target c++14 } }
3
4 template<typename> struct SpecPerType;
5
6 class Specializer
7 {
8 public:
9 template<bool> void MbrFnTempl() //Must be a template
10 {
11 }
12 template<unsigned> struct InnerClassTempl
13 { //Had to be a template whenever I tested for it
14 static void InnerMemberFn();
15 };
16
17 void Trigger()
18 {
19 InnerClassTempl<0u>::InnerMemberFn();
20 }
21 };
22
23 template<> struct SpecPerType<Specializer>
24 {
25 using FnType = void (Specializer::*)();
26 template<bool P> static constexpr FnType SpecMbrFnPtr =
27 &Specializer::template MbrFnTempl<P>;
28 };
29
30 template<bool> constexpr SpecPerType<Specializer>::FnType
31 SpecPerType<Specializer>::SpecMbrFnPtr; //Just a formalism
32
33 template<unsigned X> void Specializer::InnerClassTempl<X>::InnerMemberFn()
34 {
35 using Spec = SpecPerType<Specializer>;
36 typename Spec::FnType ErrorSite = Spec::template SpecMbrFnPtr<true>;
37 //ErrorSite would get called next in the original code
38 //(this should result in a call to MbrFnTempl)
39 }
40
41 int main()
42 {
43 }