[llvm-bugs] [Bug 44137] New: __has_c_attribute in C++ mode
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Nov 25 09:17:51 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=44137
Bug ID: 44137
Summary: __has_c_attribute in C++ mode
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: aaron at aaronballman.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Currently, __has_c_attribute is a defined macro in C++ mode and responds with
nonzero values for attributes known to C++.
e.g.,
// In C++ mode
#if defined(__has_c_attribute)
#error "ugh" // This error triggers
#endif
// In C mode
#if defined(__has_cpp_attribute)
#error "ugh" // This error does not trigger
#endif
As shown in: https://godbolt.org/z/KnyQ2G
Additionally, it seems like the behavior of C-only attribute testing is broken,
even in C mode:
#if __has_c_attribute(clang::transparent_union)
#error "ugh" // This does not trigger, even in C mode
#endif
As shown in: https://godbolt.org/z/8eHs8R
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191125/cc933e5a/attachment.html>
More information about the llvm-bugs
mailing list