[PATCH] D40526: [WebAssembly] Change size_t to `unsigned long`
Sam Clegg via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 8 09:39:35 PDT 2018
sbc100 added a comment.
I'm running into an issue with an internal codebase that assumes that size_t is equivalent to either int32_t or int64_t which this change invalidates.
After this change we have:
size_t -> long
int32_t -> int
int64_t -> ling long int.
e.g.:
#include <inttypes.h>
#include <stdlib.h>
int func(int32_t* f) {
return 1;
}
int func(int64_t* f) {
return 2;
}
int main() {
size_t a = 0 ;
return func(&a);
}
This generates the following error after this change:
./bin/clang --target=wasm32 -c ./test.cpp
./test.cpp:14:10: error: no matching function for call to 'func'
return func(&a);
^~~~
./test.cpp:4:5: note: candidate function not viable: no known conversion from 'size_t *' (aka 'unsigned long *') to 'int32_t *'
(aka 'int *') for 1st argument
int func(int32_t* f) {
^
./test.cpp:8:5: note: candidate function not viable: no known conversion from 'size_t *' (aka 'unsigned long *') to 'int64_t *'
(aka 'long long *') for 1st argument
int func(int64_t* f) {
^
1 error generated.
Repository:
rC Clang
https://reviews.llvm.org/D40526
More information about the cfe-commits
mailing list