diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2019-11-25 17:32:07 -0500 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2019-11-25 17:35:12 -0500 |
commit | d930ed1acc0ea49d4b3aae7e95b4c6d9cd310578 (patch) | |
tree | 947d5557d14981c7e0a1bedea59cd88afab7b6df /clang/test/Preprocessor/has_c_attribute.cpp | |
parent | 214683f3b2d6f421c346debf41d545de18cc0caa (diff) | |
download | bcm5719-llvm-d930ed1acc0ea49d4b3aae7e95b4c6d9cd310578.tar.gz bcm5719-llvm-d930ed1acc0ea49d4b3aae7e95b4c6d9cd310578.zip |
Disallow use of __has_c_attribute in C++ mode.
__has_cpp_attribute is not available in C mode, and __has_c_attribute
should not be available in C++ mode. This also adds a test to
demonstrate that we properly handle scoped attribute tokens even in C
mode.
Diffstat (limited to 'clang/test/Preprocessor/has_c_attribute.cpp')
-rw-r--r-- | clang/test/Preprocessor/has_c_attribute.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/has_c_attribute.cpp b/clang/test/Preprocessor/has_c_attribute.cpp new file mode 100644 index 00000000000..0bde7306717 --- /dev/null +++ b/clang/test/Preprocessor/has_c_attribute.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -std=c++11 %s -verify + +#if __has_c_attribute(fallthrough) // expected-error {{function-like macro '__has_c_attribute' is not defined}} +#endif + +#if __has_c_attribute(gnu::transparent_union) // expected-error {{function-like macro '__has_c_attribute' is not defined}} +#endif + |