[PATCH] D57196: Fix error in Visual Studio due to __has_cpp_attribute

Aaron Ballman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 28 11:47:43 PST 2019


aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a comment.

> Visual Studio introduced __has_cpp_attributed in 15.8. However, Visual
>  Studio IntelliSense does not allow :: in __has_cpp_attributed, and
>  produces error "E2512 the argument to a feature-test macro must be a
>  simple identifier" for code like #if __has_cpp_attribute(clang::...).

This is a Visual Studio bug with their IntelliSense implementation. http://eel.is/c++draft/cpp.cond#5 says the pp-tokens are to be interpreted as an attribute-token, which includes attribute-scoped-tokens.

> The VS compiler does not produce this error. The error is only produced
>  by VS IntelliSense. As a result, without this commit, although the code
>  produces an error in Visual Studio development environment, it does not
>  make the actual build fail.

IntelliSense squiggly lines often do not match the compiler behavior (IntelliSense uses a different frontend than cl, from what I understand); why do we need to work around it here? I guess I don't understand what problem this is solving given that the compilation succeeds.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57196/new/

https://reviews.llvm.org/D57196





More information about the llvm-commits mailing list