gcc/testsuite/g++.dg/lookup/template2.C
raw| 1 | // { dg-do compile } |
| 2 | |
| 3 | // Copyright (C) 2003 Free Software Foundation, Inc. |
| 4 | // Contributed by Nathan Sidwell 24 Mar 2003 <[email protected]> |
| 5 | |
| 6 | // PR 10199. Lookup problems |
| 7 | |
| 8 | class X { |
| 9 | public: |
| 10 | template<int d> |
| 11 | int bar (); |
| 12 | }; |
| 13 | |
| 14 | template<int x> |
| 15 | int fooo (); |
| 16 | |
| 17 | template<class T> |
| 18 | void bar (T& g) |
| 19 | { |
| 20 | int kk = fooo<17>(); // OK |
| 21 | X x; |
| 22 | int k = x.bar<17>(); // Not OK |
| 23 | } |
| 24 | |
| 25 | int main () |
| 26 | { |
| 27 | X x; |
| 28 | int k=x.bar<17>(); // OK |
| 29 | int n; |
| 30 | bar(n); |
| 31 | } |