Home | History | Annotate | Download | only in Lexer
      1 // RUN: %clang_cc1 -std=c++98 -verify %s
      2 // RUN: %clang_cc1 -std=c++11 -verify %s
      3 // RUN: %clang_cc1 -std=c++1y -verify %s
      4 
      5 // expected-no-diagnostics
      6 
      7 #if __cplusplus < 201103L
      8 #define check(macro, cxx98, cxx11, cxx1y) cxx98 == 0 ? defined(__cpp_##macro) : __cpp_##macro != cxx98
      9 #elif __cplusplus < 201304L
     10 #define check(macro, cxx98, cxx11, cxx1y) cxx11 == 0 ? defined(__cpp_##macro) : __cpp_##macro != cxx11
     11 #else
     12 #define check(macro, cxx98, cxx11, cxx1y) cxx1y == 0 ? defined(__cpp_##macro) : __cpp_##macro != cxx1y
     13 #endif
     14 
     15 #if check(binary_literals, 0, 0, 201304)
     16 #error "wrong value for __cpp_binary_literals"
     17 #endif
     18 
     19 #if check(init_captures, 0, 0, 201304)
     20 #error "wrong value for __cpp_init_captures"
     21 #endif
     22 
     23 #if check(generic_lambdas, 0, 0, 201304)
     24 #error "wrong value for __cpp_generic_lambdas"
     25 #endif
     26 
     27 #if check(constexpr, 0, 200704, 201304)
     28 #error "wrong value for __cpp_constexpr"
     29 #endif
     30 
     31 #if check(decltype_auto, 0, 0, 201304)
     32 #error "wrong value for __cpp_decltype_auto"
     33 #endif
     34 
     35 #if check(return_type_deduction, 0, 0, 201304)
     36 #error "wrong value for __cpp_return_type_deduction"
     37 #endif
     38 
     39 #if check(runtime_arrays, 0, 0, 0)
     40 #error "wrong value for __cpp_runtime_arrays"
     41 #endif
     42 
     43 #if check(aggregate_nsdmi, 0, 0, 201304)
     44 #error "wrong value for __cpp_aggregate_nsdmi"
     45 #endif
     46 
     47 #if check(variable_templates, 0, 0, 201304)
     48 #error "wrong value for __cpp_variable_templates"
     49 #endif
     50 
     51 #if check(unicode_characters, 0, 200704, 200704)
     52 #error "wrong value for __cpp_unicode_characters"
     53 #endif
     54 
     55 #if check(raw_strings, 0, 200710, 200710)
     56 #error "wrong value for __cpp_raw_strings"
     57 #endif
     58 
     59 #if check(unicode_literals, 0, 200710, 200710)
     60 #error "wrong value for __cpp_unicode_literals"
     61 #endif
     62 
     63 #if check(user_defined_literals, 0, 200809, 200809)
     64 #error "wrong value for __cpp_user_defined_literals"
     65 #endif
     66 
     67 #if check(lambdas, 0, 200907, 200907)
     68 #error "wrong value for __cpp_lambdas"
     69 #endif
     70 
     71 #if check(static_assert, 0, 200410, 200410)
     72 #error "wrong value for __cpp_static_assert"
     73 #endif
     74 
     75 #if check(decltype, 0, 200707, 200707)
     76 #error "wrong value for __cpp_decltype"
     77 #endif
     78 
     79 #if check(attributes, 0, 200809, 200809)
     80 #error "wrong value for __cpp_attributes"
     81 #endif
     82 
     83 #if check(rvalue_references, 0, 200610, 200610)
     84 #error "wrong value for __cpp_rvalue_references"
     85 #endif
     86 
     87 #if check(variadic_templates, 0, 200704, 200704)
     88 #error "wrong value for __cpp_variadic_templates"
     89 #endif
     90