Bug 19201 – Error: func called with argument types (ulong) matches both: __c_long and __c_ulong

Status
REOPENED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Mac OS X
Creation time
2018-08-28T16:53:12Z
Last change time
2024-12-13T19:00:25Z
Assigned to
Iain Buclaw
Creator
Iain Buclaw
See also
https://issues.dlang.org/show_bug.cgi?id=19499
Moved to GitHub: dmd#19481 →

Comments

Comment #0 by ibuclaw — 2018-08-28T16:53:12Z
Bootstrap builds with gdc are broken in master. Minimal version without dependencies. --- enum __c_long : long; enum __c_ulong : ulong; void a(ulong r){} void a(long r){} void b(__c_long r){} void b(__c_ulong r){} void main() { a(0L); b(0L); } --- Minimal version with dependencies. --- import core.stdc.stdint; void a(ulong r){} void a(long r){} void b(uint64_t r){} void b(int64_t r){} void main() { a(0L); b(0L); } --- Places in dmd that don't compile as a result: https://github.com/dlang/dmd/blob/05cdf2f55c9d6379e300382ab7af77837c6f4155/src/dmd/dcast.d#L377 https://github.com/dlang/dmd/blob/05cdf2f55c9d6379e300382ab7af77837c6f4155/src/dmd/dcast.d#L381 https://github.com/dlang/dmd/blob/05cdf2f55c9d6379e300382ab7af77837c6f4155/src/dmd/expressionsem.d#L9319 https://github.com/dlang/dmd/blob/05cdf2f55c9d6379e300382ab7af77837c6f4155/src/dmd/optimize.d#L938 The longdouble type has overrides for intXX_t and uintXX_t to be ABI compatible with C++.
Comment #1 by ibuclaw — 2018-08-28T17:16:01Z
Comment #2 by github-bugzilla — 2018-08-28T18:48:21Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/9772f49f99f0eaadad49f242f423c2cb1225031d fix Issue 19201 - func called with argument types (ulong) matches both: __c_long and __c_ulong https://github.com/dlang/dmd/commit/4b2c88529b3e9773e02991ecb53c27c1990881e5 Merge pull request #8632 from ibuclaw/issue19201 fix Issue 19201 - func called with argument types (ulong) matches both: __c_long and __c_ulong merged-on-behalf-of: Jacob Carlborg <[email protected]>
Comment #3 by bugzilla — 2018-12-22T08:14:04Z
This should be broken. long is NOT __c_long, and treating the two as an exact match does not work. (For example, template matching now fails https://issues.dlang.org/show_bug.cgi?id=19499) The DMD code that doesn't compile should be fixed with a cast, not by breaking the type system.
Comment #4 by ibuclaw — 2018-12-29T14:11:01Z
Reopened as a regression, as this no longer compiles on OSX, but compiles on Linux (it should be compilable by all). --- import core.stdc.stdint; void func(uint64_t r){} void func(int64_t r){} void main() { func(0L); } --- Conversely, this no longer compiles on Linux, but compiles on OSX (it should be rejected by all). --- import core.stdc.stdint; void func(uint64_t r){} void func(int64_t r){} void func(ulong r){} void func(long r){} void main() { func(0L); } ---
Comment #5 by ibuclaw — 2018-12-29T14:14:07Z
(In reply to Iain Buclaw from comment #4) > Conversely, this no longer compiles on Linux, but compiles on OSX (it should > be rejected by all). Or compilable by all, either or, it is a problem that two platforms behave differently depending on what int64_t is an alias to.
Comment #6 by razvan.nitu1305 — 2021-02-24T14:44:25Z
(In reply to Iain Buclaw from comment #4) > Reopened as a regression, as this no longer compiles on OSX, but compiles on > Linux (it should be compilable by all). > --- > import core.stdc.stdint; > > void func(uint64_t r){} > void func(int64_t r){} > > void main() > { > func(0L); > } > --- > This does not compile on linux either > Conversely, this no longer compiles on Linux, but compiles on OSX (it should > be rejected by all). > --- > import core.stdc.stdint; > > void func(uint64_t r){} > void func(int64_t r){} > void func(ulong r){} > void func(long r){} > > void main() > { > func(0L); > } > --- This compiles on linux also. Maybe this should be closed?
Comment #7 by ibuclaw — 2021-02-25T09:08:14Z
(In reply to RazvanN from comment #6) > (In reply to Iain Buclaw from comment #4) > > Reopened as a regression, as this no longer compiles on OSX, but compiles on > > Linux (it should be compilable by all). > > --- > > import core.stdc.stdint; > > > > void func(uint64_t r){} > > void func(int64_t r){} > > > > void main() > > { > > func(0L); > > } > > --- > > > This does not compile on linux either Yes it does (v2.094.2-beta.1-559-g4522e0236) > > > Conversely, this no longer compiles on Linux, but compiles on OSX (it should > > be rejected by all). > > --- > > import core.stdc.stdint; > > > > void func(uint64_t r){} > > void func(int64_t r){} > > void func(ulong r){} > > void func(long r){} > > > > void main() > > { > > func(0L); > > } > > --- > > This compiles on linux also. > No it doesn't (v2.094.2-beta.1-559-g4522e0236)
Comment #8 by robert.schadek — 2024-12-13T19:00:25Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19481 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB