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: unassignedclangb...@nondot.org
          Reporter: ndkrem...@gmail.com
                CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
                    llvm-bugs@lists.llvm.org, richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to