diff options
| author | Ed Schouten <ed@FreeBSD.org> | 2009-06-22 08:08:35 +0000 |
|---|---|---|
| committer | Ed Schouten <ed@FreeBSD.org> | 2009-06-22 08:08:35 +0000 |
| commit | b897c8660c4ff7037dde81b9645737bc1c992abe (patch) | |
| tree | b6403365e77095a79062d3379c9e6aea0df5f088 /test/Parser | |
| parent | 7ef7bab7e3d06f660b059b903c231f100bb13cc5 (diff) | |
Notes
Diffstat (limited to 'test/Parser')
| -rw-r--r-- | test/Parser/cxx-template-decl.cpp | 11 | ||||
| -rw-r--r-- | test/Parser/cxx-using-declaration.cpp | 45 | ||||
| -rw-r--r-- | test/Parser/cxx-using-directive.cpp | 3 | ||||
| -rw-r--r-- | test/Parser/namespace-alias-attr.cpp | 8 |
4 files changed, 65 insertions, 2 deletions
diff --git a/test/Parser/cxx-template-decl.cpp b/test/Parser/cxx-template-decl.cpp index ae5d8f9e0cce5..75b26a98e44ec 100644 --- a/test/Parser/cxx-template-decl.cpp +++ b/test/Parser/cxx-template-decl.cpp @@ -66,6 +66,17 @@ class T { // expected-error{{declaration of 'T' shadows template parameter}} template<int Size> // expected-note{{template parameter is declared here}} void shadow3(int Size); // expected-error{{declaration of 'Size' shadows template parameter}} +// <rdar://problem/6952203> +template<typename T> // expected-note{{here}} +struct shadow4 { + int T; // expected-error{{shadows}} +}; + +template<typename T> // expected-note{{here}} +struct shadow5 { + int T(int, float); // expected-error{{shadows}} +}; + // Non-type template parameters in scope template<int Size> void f(int& i) { diff --git a/test/Parser/cxx-using-declaration.cpp b/test/Parser/cxx-using-declaration.cpp new file mode 100644 index 0000000000000..de0e6f162a768 --- /dev/null +++ b/test/Parser/cxx-using-declaration.cpp @@ -0,0 +1,45 @@ +// RUN: clang-cc -fsyntax-only -verify %s
+
+namespace A {
+ int VA;
+ void FA() {}
+ struct SA { int V; };
+}
+
+using A::VA;
+using A::FA;
+using typename A::SA;
+
+void main()
+{
+ VA = 1;
+ FA();
+ SA x; //Still needs handling.
+}
+
+struct B {
+ void f(char){};
+ void g(char){};
+};
+struct D : B {
+ using B::f;
+ void f(int);
+ void g(int);
+};
+void D::f(int) { f('c'); } // calls B::f(char)
+void D::g(int) { g('c'); } // recursively calls D::g(int)
+
+namespace E {
+ template <typename TYPE> int funcE(TYPE arg) { return(arg); }
+}
+
+using E::funcE<int>; // expected-error{{use of template specialization in using directive not allowed}}
+
+namespace F {
+ struct X;
+}
+
+using F::X;
+// Should have some errors here. Waiting for implementation.
+void X(int);
+struct X *x;
diff --git a/test/Parser/cxx-using-directive.cpp b/test/Parser/cxx-using-directive.cpp index 676f4e6c5a5e1..504d026b43919 100644 --- a/test/Parser/cxx-using-directive.cpp +++ b/test/Parser/cxx-using-directive.cpp @@ -13,8 +13,7 @@ namespace D { class C { - using namespace B ; // expected-error{{expected member name or ';' after declaration specifiers}} - //FIXME: this needs better error message + using namespace B ; // expected-error{{not allowed}} }; namespace B {} diff --git a/test/Parser/namespace-alias-attr.cpp b/test/Parser/namespace-alias-attr.cpp new file mode 100644 index 0000000000000..9e4072cde2252 --- /dev/null +++ b/test/Parser/namespace-alias-attr.cpp @@ -0,0 +1,8 @@ +// RUN: clang-cc -verify %s + +namespace A +{ +} + +namespace B __attribute__ (( static )) = A; // expected-error{{attributes can not be specified on namespace alias}} + |
