From: Richard Smith Date: Thu, 13 Oct 2011 21:32:47 +0000 (+0000) Subject: Add test for new -std=c++11 and -std=gnu++11 command-line arguments. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0b1b5b89cc8b63aa3192a1c94e712e8a9b1a006f;p=clang Add test for new -std=c++11 and -std=gnu++11 command-line arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141891 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Driver/std.cpp b/test/Driver/std.cpp new file mode 100644 index 0000000000..99deb11365 --- /dev/null +++ b/test/Driver/std.cpp @@ -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'