[PATCH] D157297: [clang] Fixes compile error like error: expected unqualified-id for ::_tzcnt_u32(mask);

Phoebe Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 05:20:45 PDT 2023


pengfei added a comment.

In D157297#4583802 <https://reviews.llvm.org/D157297#4583802>, @lygstate wrote:

> In D157297#4571572 <https://reviews.llvm.org/D157297#4571572>, @pengfei wrote:
>
>> The description is not clear to me. You should describe the reason rather than phenomenon.
>>
>> My understanding is double colon operator cannot resolve functions with parentheses. https://godbolt.org/z/6P47se9WW
>
> error: expected unqualified-id
>
>   return ::_tzcnt_u32(a);
>            ^
>
> /opt/compiler-explorer/clang-16.0.0/lib/clang/16/include/bmiintrin.h:74:27: note: expanded from macro '_tzcnt_u32'
> #define _tzcnt_u32(a)     (__tzcnt_u32((a)))
>
> Looks like double colon operator cannot resolve macros with parentheses, is that a compiler bug or we should handled it in code?
>
>> But I didn't find enough proof in Google. It'd be more persuasive if you can find it and add to the description.

GCC doesn't resolve it either. https://godbolt.org/z/Prb4s5d6o. So it should not be a bug.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157297



More information about the cfe-commits mailing list