Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/template/using4.C @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 // { dg-do run } | |
2 | |
3 // Copyright (C) 2003 Free Software Foundation, Inc. | |
4 // Contributed by Nathan Sidwell 22 Jul 2003 <nathan@codesourcery.com> | |
5 | |
6 // PR 9447. Using decls in template classes. | |
7 | |
8 template <class T> | |
9 struct Foo { | |
10 int k (float) {return 1;} | |
11 }; | |
12 | |
13 struct Baz | |
14 { | |
15 int k (int) {return 2;} | |
16 }; | |
17 | |
18 template <class T> | |
19 struct Bar : public Foo<T> , Baz { | |
20 using Foo<T>::k; | |
21 using Baz::k; | |
22 | |
23 int foo() | |
24 { | |
25 if (k (1.0f) != 1) | |
26 return 1; | |
27 if (k (1) != 2) | |
28 return 2; | |
29 | |
30 return 0; | |
31 } | |
32 }; | |
33 | |
34 int main() | |
35 { | |
36 Bar<int> bar; | |
37 | |
38 return bar.foo(); | |
39 } |