Debian Codegraph @

gcc/testsuite/g++.dg/overload/member2.C

raw
1 // { dg-do run }
2
3 // Copyright (C) 2001 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 17 Oct 2002 <[email protected]>
5
6 // PR 7676. We didn't notice template members were different.
7
8 struct foo
9 {
10 template<class T>
11 int bar() {return 1;}
12
13 template<int I>
14 int bar() {return 2;}
15
16 };
17
18 struct baz : foo
19 {
20 using foo::bar;
21 template<int I>
22 int bar () {return 3;}
23 };
24
25 int main ()
26 {
27 baz b;
28 foo f;
29
30 if (f.bar<1> () != 2)
31 return 1;
32 if (f.bar<int> () != 1)
33 return 2;
34
35 if (b.bar<1> () != 3)
36 return 1;
37 if (b.bar<int> () != 1)
38 return 2;
39
40 return 0;
41 }