Closed suikan4github closed 3 days ago
Could you please try 19 or main
branch? https://godbolt.org should be helpful.
@llvm/issue-subscribers-clang-frontend
Author: Seiichi "Suikan" Horie (suikan4github)
@suikan4github: just use link, so other people could run verify.
@EugeneZelenko You can see the link.
@suikan4github: I meant that screenshot is not needed.
clang is correct, this is a duplicate of: https://github.com/llvm/llvm-project/issues/25556
Please file a bug w/ gcc and edg: https://godbolt.org/z/9o91nnPbh
MSVC also gets this right.
Note as explained in the dup using ()
disambiguates:
uint32_t (::foo::bar)(unsigned int a) { return a; }
Also note int
is a keyword and not an identifier.
Overview
Clang shows an error when a class member function definiton has both :
This problem is not found with GCC.
Code to demonstrate
In the following code, uint32_t is typedefed inside stdint.h. Copy this code into foo.cpp.
To reproduce the problem, run the following command.
Workaround
To avoid this problem, we should use non-typedefed return type in the function definiton.
Or, we should not to use the global :: scope operator in the function definition.
Environment and version