OSDN Git Service

PR c++/53549
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / template / partial6.C
1 // PR c++/41703
2 // The second GetAllSize template is more specialized because even though
3 // deduction on each parameter type succeeds, we never get a template
4 // argument for its X to make it match the first template.
5
6 template <typename T, int (T::*)() const>
7 struct TSizeEnabler
8 {
9     typedef T TClass;
10 };
11
12 template <typename X>
13 int
14 GetAllSize(const X &Var)
15 { return sizeof(Var); }
16
17 template <typename X>
18 int
19 GetAllSize(const typename TSizeEnabler<X, &X::func>::TClass &Var)
20 { return Var.func(); }
21
22 struct H
23 {
24     int func() const;
25 };
26
27 int main()
28 {
29     H b;
30     return GetAllSize< H >(b);
31 }