HaxeFoundation / HaxeFoundation/hxcpp

Ambiguous overloading of operator >> with cpp:Variant and int

Open
#654 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
330
Forks
227
Avg merge
2d 16h
Merged PRs (30d)
18

Description

@hughsando I'm having an issue with hxcpp and the `format` library (and Haxe 4.0.0 git version).
It looks like the `png/Tools.hx` file has the following line

```
var rline = (h.width * h.colbits) >> 3;
```
https://github.com/HaxeFoundation/format/blob/master/format/png/Tools.hx#L274

being translated to this:

```
int rline = ((h->__Field(HX_("width",06,b6,62,ca),hx::paccDynamic) * h->__Field(HX_("colbits",46,9b,c7,e6),hx::paccDynamic)) >> 3);
```

But when the C++ compiler kicks in it's complaining with the following error:

```
Error: ./src/format/png/Tools.cpp:2141:130: error: use of overloaded operator '>>' is ambiguous (with operand types 'cpp::Variant' and 'int')
int rline = ((h->__Field(HX_("width",06,b6,62,ca),hx::paccDynamic) * h->__Field(HX_("colbits",46,9b,c7,e6),hx::paccDynamic)) >> 3);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(int, int)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned __int128, int)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned long long, int)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned long, int)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned int, int)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(__int128, int)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(long long, int)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(long, int)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(int, unsigned __int128)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(long, long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(long, long long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(long, __int128)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(long, unsigned int)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(long, unsigned long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(long, unsigned long long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(long, unsigned __int128)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(int, unsigned long long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(long long, long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(long long, long long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(long long, __int128)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(long long, unsigned int)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(long long, unsigned long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(long long, unsigned long long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(long long, unsigned __int128)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(int, unsigned long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(__int128, long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(__int128, long long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(__int128, __int128)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(__int128, unsigned int)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(__int128, unsigned long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(__int128, unsigned long long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(__int128, unsigned __int128)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(int, unsigned int)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned int, long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned int, long long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned int, __int128)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned int, unsigned int)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned int, unsigned long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned int, unsigned long long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned int, unsigned __int128)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(int, __int128)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned long, long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned long, long long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned long, __int128)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned long, unsigned int)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned long, unsigned long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned long, unsigned long long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned long, unsigned __int128)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(int, long long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned long long, long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned long long, long long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned long long, __int128)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned long long, unsigned int)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned long long, unsigned long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned long long, unsigned long long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned long long, unsigned __int128)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(int, long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned __int128, long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned __int128, long long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned __int128, __int128)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned __int128, unsigned int)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned __int128, unsigned long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned __int128, unsigned long long)
./src/format/png/Tools.cpp:2141:130: note: built-in candidate operator>>(unsigned __int128, unsigned __int128)
1 error generated.
Error: Build failed
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.