[PATCH] D146492: Add new printNumber() for size_t
Junhee Yoo via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 21 11:16:40 PDT 2023
junhee-yoo added a comment.
@jhenderson Thanks for your kind comment.
>From your comment, I've inspected each alias types `uint64_t` and `size_t` in Windows(by reference), Linux(by IDE) and macOS(by IDE).
After this, I found that macOS has different base type for `uint64_t` and `size_t` but their size is same.
| | uint64_t | size_t |
| Windows, Ref <https://learn.microsoft.com/en-us/cpp/c-runtime-library/standard-types?view=msvc-170> | unsigned long long | unsigned long long |
| Linux (x86_64, ubuntu 22.04, Ubuntu clang version 14.0.0-1ubuntu1) | unsigned long, size: 8 | unsigned long, size: 8 |
| macOS (M1 <https://reviews.llvm.org/M1> Pro(aarch64), MacOSX13.1.sdk + Homebrew clang version 14.0.6) | **unsigned long long**, size: 8 | **unsigned long**, size: 8 |
|
I guess this is my compile error comes from. I checked this with a small experiment on my macOS:
#include <iostream>
void print(uint64_t a) {
std::cout << a << std::endl;
}
void print(int64_t a) {
std::cout << a << std::endl;
}
int main()
{
size_t a = 10;
print(a); // error: call to 'print' is ambiguous
return 0;
}
I thought if I use only homebrew llvm at 14, this ambiguous problem could be solved, but I couldn't remove or properly change my `isysroot` arguments from my CMake configure.
(I also changed CMAKE_OSX_SYSROOT <https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_SYSROOT.html> in my CMake config, it occurs include header not found error)
So, instead of it, I've tried to compile above experiment C++ code with homebrew clang and results is same: `error: call to 'print' is ambiguous`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146492/new/
https://reviews.llvm.org/D146492
More information about the llvm-commits
mailing list