1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 // C++03 [namespace.udecl]p11: (per DR101)
4 // If a function declaration in namespace scope or block scope has
5 // the same name and the same parameter types as a function
6 // introduced by a using-declaration, and the declarations do not declare the
7 // same function, the program is ill-formed. [Note: two using-declarations may
8 // introduce functions with the same name and the same parameter types. If,
9 // for a call to an unqualified function name, function overload resolution
10 // selects the functions introduced by such using-declarations, the function
11 // call is ill-formed.]
13 // FIXME: DR565 introduces parallel wording here for function templates.
16 namespace ns
{ void foo(); } // expected-note {{target of using declaration}}
17 int foo(void); // expected-note {{conflicting declaration}}
18 using ns::foo
; // expected-error {{target of using declaration conflicts with declaration already in scope}}
22 namespace ns
{ void foo(); } // expected-note {{target of using declaration}}
23 using ns::foo
; //expected-note {{using declaration}}
24 int foo(void); // expected-error {{declaration conflicts with target of using declaration already in scope}}
28 namespace ns
{ void foo(); } // expected-note 2 {{target of using declaration}}
30 int foo(void); // expected-note {{conflicting declaration}}
31 using ns::foo
; // expected-error {{target of using declaration conflicts with declaration already in scope}}
35 using ns::foo
; //expected-note {{using declaration}}
36 int foo(void); // expected-error {{declaration conflicts with target of using declaration already in scope}}
41 namespace ns
{ void foo(); } // expected-note 2 {{target of using declaration}}
44 int foo(void); // expected-note {{conflicting declaration}}
45 using ns::foo
; // expected-error {{target of using declaration conflicts with declaration already in scope}}
51 using ns::foo
; //expected-note {{using declaration}}
52 int foo(void); // expected-error {{declaration conflicts with target of using declaration already in scope}}
58 namespace ns
{ void foo(); } // expected-note 2 {{target of using declaration}}
59 template <typename
> class Test0
{
61 int foo(void); // expected-note {{conflicting declaration}}
62 using ns::foo
; // expected-error {{target of using declaration conflicts with declaration already in scope}}
66 template <typename
> class Test1
{
68 using ns::foo
; //expected-note {{using declaration}}
69 int foo(void); // expected-error {{declaration conflicts with target of using declaration already in scope}}
74 // FIXME: we should be able to diagnose both of these, but we can't.
76 namespace ns
{ void foo(int); }
77 template <typename T
> class Test0
{
84 template <typename T
> class Test1
{
91 template class Test0
<int>;
92 template class Test1
<int>;
96 namespace ns
{ void foo(); } // expected-note {{target of using declaration}}
97 using ns::foo
; // expected-note {{using declaration}}
102 void foo(); // expected-error {{declaration conflicts with target of using declaration already in scope}}