diff options
Diffstat (limited to 'clang/test/CXX/basic/basic.lookup/basic.lookup.unqual')
7 files changed, 129 insertions, 0 deletions
diff --git a/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p11.cpp b/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p11.cpp new file mode 100644 index 0000000..a1cf529 --- /dev/null +++ b/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p11.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +static const int a = 10; + +void f0(int a, + int b = a) { // expected-error {{default argument references parameter 'a'}} +} + +template<int a, + int b = a> +class A { +}; diff --git a/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p12.cpp b/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p12.cpp new file mode 100644 index 0000000..878ff07 --- /dev/null +++ b/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p12.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +struct S {}; +S E0; + +namespace { + enum { + E0 = 1, + E1 = E0 + 1 + }; +} + + diff --git a/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p13.cpp b/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p13.cpp new file mode 100644 index 0000000..58d7ff4 --- /dev/null +++ b/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p13.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +struct S { + static const int f0 = 0; + static int f1; +}; + +int S::f1 = f0; diff --git a/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp b/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp new file mode 100644 index 0000000..0fa4f65 --- /dev/null +++ b/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// C++0x [basic.lookup.unqual]p14: +// If a variable member of a namespace is defined outside of the +// scope of its namespace then any name used in the definition of +// the variable member (after the declarator-id) is looked up as if +// the definition of the variable member occurred in its namespace. + +namespace N { + struct S {}; + S i; + extern S j; + extern S j2; +} + +int i = 2; +N::S N::j = i; +N::S N::j2(i); diff --git a/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p15.cpp b/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p15.cpp new file mode 100644 index 0000000..253d15e --- /dev/null +++ b/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p15.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// XFAIL: * + +class C { +public: + C(int a, int b); +}; + +C::C(int a, // expected-note {{previous definition}} + int b) // expected-note {{previous definition}} +try { + int c; + +} catch (int a) { // expected-error {{redefinition of 'a'}} + int b; // expected-error {{redefinition of 'b'}} + ++c; // expected-error {{use of undeclared identifier 'c'}} +} diff --git a/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp b/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp new file mode 100644 index 0000000..20a7ae0 --- /dev/null +++ b/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +typedef int f; + +namespace N0 { + struct A { + friend void f(); + void g() { + int i = f(1); + } + }; +} + +namespace N1 { + struct A { + friend void f(A &); + operator int(); + void g(A a) { + // ADL should not apply to the lookup of 'f', it refers to the typedef + // above. + int i = f(a); + } + }; +} diff --git a/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp b/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp new file mode 100644 index 0000000..d2afd5d --- /dev/null +++ b/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p7.cpp @@ -0,0 +1,37 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// PR5741 +namespace test0 { + struct A { + struct B { }; + struct C; + }; + + struct A::C : B { }; +} + +// Test that successive base specifiers don't screw with each other. +namespace test1 { + struct Opaque1 {}; + struct Opaque2 {}; + + struct A { + struct B { B(Opaque1); }; + }; + struct B { + B(Opaque2); + }; + + struct C : A, B { + // Apparently the base-or-member lookup is actually ambiguous + // without this qualification. + C() : A(), test1::B(Opaque2()) {} + }; +} + +// Test that we don't find the injected class name when parsing base +// specifiers. +namespace test2 { + template <class T> struct bar {}; + template <class T> struct foo : bar<foo> {}; // expected-error {{use of class template foo requires template arguments}} expected-note {{template is declared here}} +} |