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

Yonggang Luo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 13 23:45:17 PDT 2023


lygstate added a comment.

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.




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