]> granicus.if.org Git - clang/commitdiff
Add some random C++ standard tests.
authorDaniel Dunbar <daniel@zuster.org>
Sat, 13 Jun 2009 06:16:36 +0000 (06:16 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sat, 13 Jun 2009 06:16:36 +0000 (06:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73287 91177308-0d34-0410-b5e6-96231b3b80d8

test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p3.cpp [new file with mode: 0644]
test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p4.cpp [new file with mode: 0644]
test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp [new file with mode: 0644]
test/CXX/dcl.dcl/dcl.spec/dcl.stc/p10.cpp [new file with mode: 0644]
test/CXX/dcl.dcl/dcl.spec/dcl.stc/p9.cpp [new file with mode: 0644]
test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p3.cpp [new file with mode: 0644]
test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp [new file with mode: 0644]

diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p3.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p3.cpp
new file mode 100644 (file)
index 0000000..3b0e345
--- /dev/null
@@ -0,0 +1,11 @@
+// RUN: clang-cc -verify %s
+// XFAIL
+
+void f0(void) {
+  inline void f1(); // expected-error {{'inline' is not allowed on block scope function declaration}}
+}
+
+// FIXME: Add test for "If the inline specifier is used in a friend declaration,
+// that declaration shall be a definition or the function shall have previously
+// been declared inline.
+
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p4.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p4.cpp
new file mode 100644 (file)
index 0000000..0142dcb
--- /dev/null
@@ -0,0 +1,7 @@
+// RUN: clang-cc -verify %s
+// XFAIL
+
+void f0() {
+}
+
+inline void f0(); // expected-error {{function definition cannot preceed inline declaration}}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp
new file mode 100644 (file)
index 0000000..c5f0a51
--- /dev/null
@@ -0,0 +1,13 @@
+// RUN: clang-cc -verify %s
+// XFAIL
+
+class A {
+public:
+  explicit A();
+  
+  explicit operator int(); // expected-warning {{explicit conversion functions are a C++0x extension}}
+
+  explicit void f0(); // expected-error {{'explicit' cannot only be applied to constructor or conversion function}}
+};
+
+explicit A::A() { } // expected-error {{'explicit' cannot be specified outside class definition}}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p10.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p10.cpp
new file mode 100644 (file)
index 0000000..62ae7bf
--- /dev/null
@@ -0,0 +1,14 @@
+// RUN: clang-cc -verify %s
+// XFAIL
+
+typedef const int T0;
+typedef int& T1;
+
+struct s0 {
+  mutable const int f0; // expected-error{{'mutable' and 'const' cannot be mixed}}
+  mutable T0 f1; // expected-error{{'mutable' and 'const' cannot be mixed}}
+  mutable int &f2; // expected-error{{'mutable' cannot be applied to references}}
+  mutable T1 f3; // expected-error{{'mutable' cannot be applied to references}}
+  mutable struct s1 {}; // expected-error{{'mutable' cannot be applied to non-data members}}
+  mutable void im0(); // expected-error{{'mutable' cannot be applied to functions}}
+};
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p9.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p9.cpp
new file mode 100644 (file)
index 0000000..5d9f9e7
--- /dev/null
@@ -0,0 +1,12 @@
+// RUN: clang-cc -verify %s
+
+struct S; // expected-note {{forward declaration of 'struct S'}}
+extern S a;
+extern S f();
+extern void g(S a); // expected-note {{candidate function}}
+
+void h() {
+  // FIXME: This diagnostic could be better.
+  g(a); // expected-error {{no matching function for call to 'g'}}
+  f(); // expected-error {{return type of called function ('struct S') is incomplete}}
+}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p3.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p3.cpp
new file mode 100644 (file)
index 0000000..867b4f0
--- /dev/null
@@ -0,0 +1,8 @@
+// RUN: clang-cc -verify %s
+
+typedef struct s { int x; } s;
+typedef int I;
+typedef int I2;
+typedef I2 I; // expected-note {{previous definition is here}}
+
+typedef char I; // expected-error {{typedef redefinition with different types}}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp
new file mode 100644 (file)
index 0000000..f1413f9
--- /dev/null
@@ -0,0 +1,9 @@
+// RUN: clang-cc -verify %s
+// XFAIL
+
+struct S {
+  typedef struct A {} A; // expected-note {{previous definition is here}}
+  typedef struct B B;
+  typedef A A; // expected-error {{redefinition of 'A'}}
+};
+