Debian Codegraph @

gcc/testsuite/g++.dg/lookup/using2.C

raw
1 // Copyright (C) 2001, 2002, 2009 Free Software Foundation, Inc.
2 //
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
7 // any later version.
8
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
17
18 // Contributed by Gabriel Dos Reis <[email protected]>
19
20 // { dg-do compile }
21
22 namespace N
23 {
24 template<int> void f() {}
25 }
26
27 using N; // { dg-error "(using-declaration)|(nested-name)" }
28 using ::N; // { dg-error "using-declaration" }
29 using N::f< 0 >; // { dg-error "using-declaration" }
30
31 struct A {
32 template <class T> void f(T);
33 template <class T> struct X { };
34 };
35
36 struct B : A {
37 using A::X; // OK
38 using A::f; // OK
39 };
40
41 struct C : A {
42 using A::f<double>; // { dg-error "using-declaration" }
43 using A::X<int>; // { dg-error "using-declaration" }
44 };
45