]> granicus.if.org Git - clang/commitdiff
Add test for new -std=c++11 and -std=gnu++11 command-line arguments.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 13 Oct 2011 21:32:47 +0000 (21:32 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 13 Oct 2011 21:32:47 +0000 (21:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141891 91177308-0d34-0410-b5e6-96231b3b80d8

test/Driver/std.cpp [new file with mode: 0644]

diff --git a/test/Driver/std.cpp b/test/Driver/std.cpp
new file mode 100644 (file)
index 0000000..99deb11
--- /dev/null
@@ -0,0 +1,23 @@
+// RUN: %clang -std=c++98 %s -Wno-c++0x-compat -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX98 %s
+// RUN: %clang -std=gnu++98 %s -Wno-c++0x-compat -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX98 %s
+// RUN: %clang -std=c++0x %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX11 %s
+// RUN: %clang -std=gnu++0x %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX11 %s
+// RUN: %clang -std=c++11 %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX11 %s
+// RUN: %clang -std=gnu++11 %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX11 %s
+
+void f(int n) {
+  typeof(n)();
+  decltype(n)();
+}
+
+// CXX98: undeclared identifier 'typeof'
+// CXX98: undeclared identifier 'decltype'
+
+// GNUXX98-NOT: undeclared identifier 'typeof'
+// GNUXX98: undeclared identifier 'decltype'
+
+// CXX11: undeclared identifier 'typeof'
+// CXX11-NOT: undeclared identifier 'decltype'
+
+// GNUXX11-NOT: undeclared identifier 'typeof'
+// GNUXX11-NOT: undeclared identifier 'decltype'