Home | History | Annotate | Download | only in SemaCXX
      1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wc++98-compat-pedantic -verify %s
      2 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wc++98-compat -Werror %s
      3 // RUN: %clang_cc1 -fsyntax-only -std=c++98 -Werror %s
      4 
      5 // -Wc++98-compat-pedantic warns on C++11 features which we accept without a
      6 // warning in C++98 mode.
      7 
      8 #line 32767 // ok
      9 #line 32768 // expected-warning {{#line number greater than 32767 is incompatible with C++98}}
     10 
     11 #define VA_MACRO(x, ...) x // expected-warning {{variadic macros are incompatible with C++98}}
     12 VA_MACRO(,x) // expected-warning {{empty macro argument list is incompatible with C++98}}
     13 
     14 ; // expected-warning {{extra ';' outside of a function is incompatible with C++98}}
     15 
     16 enum Enum {
     17   Enum_value, // expected-warning {{commas at the end of enumerator lists are incompatible with C++98}}
     18 };
     19 
     20 template<typename T> struct InstantiationAfterSpecialization {};
     21 template<> struct InstantiationAfterSpecialization<int> {}; // expected-note {{here}}
     22 template struct InstantiationAfterSpecialization<int>; // expected-warning {{explicit instantiation of 'InstantiationAfterSpecialization<int>' that occurs after an explicit specialization is incompatible with C++98}}
     23 
     24 void *dlsym();
     25 void (*FnPtr)() = (void(*)())dlsym(); // expected-warning {{cast between pointer-to-function and pointer-to-object is incompatible with C++98}}
     26 void *FnVoidPtr = (void*)&dlsym; // expected-warning {{cast between pointer-to-function and pointer-to-object is incompatible with C++98}}
     27 
     28 struct ConvertToInt {
     29   operator int();
     30 };
     31 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}}
     32