[llvm-bugs] [Bug 48462] New: Macro expansion not performed on argument to __has_cpp_attribute

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 9 11:01:04 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=48462

            Bug ID: 48462
           Summary: Macro expansion not performed on argument to
                    __has_cpp_attribute
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ndkrempel at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

C++20 specifies that the pp-tokens given to __has_cpp_attribute are subject to
macro expansion (http://eel.is/c++draft/cpp.cond#5). GCC performs macro
expansion here, but clang does not. For example (compiled with -std=c++20):

  #define X noreturn
  #if !__has_cpp_attribute(X)
    #error FAIL
  #endif

(https://gcc.godbolt.org/z/jWG586)

The above program hits the error case, whereas using "noreturn" directly
instead of "X" does not.

-- 
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/20201209/c6c24226/attachment-0001.html>


More information about the llvm-bugs mailing list