has_feature_cxx0x.cpp revision 16cf8f5b6f582876b64e132715280fc473f876b9
1// RUN: %clang_cc1 -E -std=c++0x %s -o - | FileCheck --check-prefix=CHECK-0X %s 2// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-0X %s 3 4#if __has_feature(cxx_lambdas) 5int lambdas(); 6#else 7int no_lambdas(); 8#endif 9 10// CHECK-0X: no_lambdas 11// CHECK-NO-0X: no_lambdas 12 13 14#if __has_feature(cxx_nullptr) 15int has_nullptr(); 16#else 17int no_nullptr(); 18#endif 19 20// CHECK-0X: no_nullptr 21// CHECK-NO-0X: no_nullptr 22 23 24#if __has_feature(cxx_decltype) 25int has_decltype(); 26#else 27int no_decltype(); 28#endif 29 30// CHECK-0X: has_decltype 31// CHECK-NO-0X: no_decltype 32 33 34#if __has_feature(cxx_auto_type) 35int auto_type(); 36#else 37int no_auto_type(); 38#endif 39 40// CHECK-0X: auto_type 41// CHECK-NO-0X: no_auto_type 42 43 44#if __has_feature(cxx_attributes) 45int attributes(); 46#else 47int no_attributes(); 48#endif 49 50// CHECK-0X: attributes 51// CHECK-NO-0X: no_attributes 52 53 54#if __has_feature(cxx_static_assert) 55int has_static_assert(); 56#else 57int no_static_assert(); 58#endif 59 60// CHECK-0X: has_static_assert 61// CHECK-NO-0X: no_static_assert 62 63// We accept this as an extension. 64#if __has_feature(cxx_deleted_functions) 65int deleted_functions(); 66#else 67int no_deleted_functions(); 68#endif 69 70// CHECK-0X: deleted_functions 71// CHECK-NO-0X: deleted_functions 72 73 74#if __has_feature(cxx_rvalue_references) 75int rvalue_references(); 76#else 77int no_rvalue_references(); 78#endif 79 80// CHECK-0X: rvalue_references 81// CHECK-NO-0X: rvalue_references 82 83 84#if __has_feature(cxx_variadic_templates) 85int variadic_templates(); 86#else 87int no_variadic_templates(); 88#endif 89 90// CHECK-0X: variadic_templates 91// Note: We allow variadic templates in C++98/03 with a warning. 92// CHECK-NO-0X: variadic_templates 93 94 95#if __has_feature(cxx_inline_namespaces) 96int inline_namespaces(); 97#else 98int no_inline_namespaces(); 99#endif 100 101// CHECK-0X: inline_namespaces 102// CHECK-NO-0X: inline_namespaces 103