diff options
author | Yonggang Luo <luoyonggang@gmail.com> | 2023-12-05 15:49:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-05 15:49:31 +0800 |
commit | 8cfdd37088d662338ec85ac15721dddf3f6d8db6 (patch) | |
tree | bb3eae36822846d9c9119e3bcaa55a043bca7bc6 /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | 543589af492b43d1fe21aaf499bd4d168e64abf1 (diff) | |
download | llvm-8cfdd37088d662338ec85ac15721dddf3f6d8db6.zip llvm-8cfdd37088d662338ec85ac15721dddf3f6d8db6.tar.gz llvm-8cfdd37088d662338ec85ac15721dddf3f6d8db6.tar.bz2 |
[clang] Fixes compile error that double colon operator cannot resolve macro with parentheses. (#68618)
Error message:
```
In file included from ../src/amd/addrlib/src/core/addrobject.h:21:
../src/amd/addrlib/src/core/addrcommon.h:343:13: error: expected unqualified-id
out = ::_tzcnt_u32(mask);
^
/usr/lib/llvm-15/lib/clang/15.0.6/include/bmiintrin.h:74:27: note: expanded from macro '_tzcnt_u32'
#define _tzcnt_u32(a) (__tzcnt_u32((a)))
```
This is because both GCC/Clang doesn't support compiling the following
code:
```
#ifdef _MSC_VER
#include <intrin.h>
#else
#include <x86intrin.h>
#endif
int f(int a) {
return ::(_tzcnt_u32)(a);
}
```
This is because the return statement expects an expression or braced
init list: http://eel.is/c++draft/stmt.jump#general-1 but we really only
need to care about the expression form (there's no braces in sight).
Grammatically, the leading :: will parse as a qualified-id because it
matches the production for nested-name-specifier:
http://eel.is/c++draft/expr.prim.id.qual#nt:qualified-id That needs to
be followed by an unqualified-id
(http://eel.is/c++draft/expr.prim.id.unqual#nt:unqualified-id), but the
open paren does not match any of the grammar productions, so this is a
syntax error.
Closes: https://github.com/llvm/llvm-project/issues/64467
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions