From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/SemaCXX/cxx98-compat-pedantic.cpp | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 clang/test/SemaCXX/cxx98-compat-pedantic.cpp (limited to 'clang/test/SemaCXX/cxx98-compat-pedantic.cpp') diff --git a/clang/test/SemaCXX/cxx98-compat-pedantic.cpp b/clang/test/SemaCXX/cxx98-compat-pedantic.cpp new file mode 100644 index 0000000..00532d5 --- /dev/null +++ b/clang/test/SemaCXX/cxx98-compat-pedantic.cpp @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wc++98-compat-pedantic -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wc++98-compat -Werror %s +// RUN: %clang_cc1 -fsyntax-only -std=c++98 -Werror %s + +// -Wc++98-compat-pedantic warns on C++11 features which we accept without a +// warning in C++98 mode. + +#line 32767 // ok +#line 32768 // expected-warning {{#line number greater than 32767 is incompatible with C++98}} + +#define VA_MACRO(x, ...) x // expected-warning {{variadic macros are incompatible with C++98}} +VA_MACRO(,x) // expected-warning {{empty macro argument list is incompatible with C++98}} + +; // expected-warning {{extra ';' outside of a function is incompatible with C++98}} + +enum Enum { + Enum_value, // expected-warning {{commas at the end of enumerator lists are incompatible with C++98}} +}; + +template struct InstantiationAfterSpecialization {}; +template<> struct InstantiationAfterSpecialization {}; // expected-note {{here}} +template struct InstantiationAfterSpecialization; // expected-warning {{explicit instantiation of 'InstantiationAfterSpecialization' that occurs after an explicit specialization is incompatible with C++98}} + +void *dlsym(); +void (*FnPtr)() = (void(*)())dlsym(); // expected-warning {{cast between pointer-to-function and pointer-to-object is incompatible with C++98}} +void *FnVoidPtr = (void*)&dlsym; // expected-warning {{cast between pointer-to-function and pointer-to-object is incompatible with C++98}} + +struct ConvertToInt { + operator int(); +}; +int *ArraySizeConversion = new int[ConvertToInt()]; // expected-warning {{implicit conversion from array size expression of type 'ConvertToInt' to integral type 'int' is incompatible with C++98}} + +template class ExternTemplate {}; +extern template class ExternTemplate; // expected-warning {{extern templates are incompatible with C++98}} -- cgit v1.2.3