Bug 18777 – std.traits.RetrunType ambiguity

Status
RESOLVED
Resolution
DUPLICATE
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Mac OS X
Creation time
2018-04-18T17:11:22Z
Last change time
2018-04-19T20:30:43Z
Assigned to
No Owner
Creator
Matt

Comments

Comment #0 by mattbowiewilson — 2018-04-18T17:11:22Z
import std.stdio; import std.traits : ReturnType; int foo() { return 1; } short foo() { return 1; } void main() { // This prints 2147483647 but why not 32767? writeln(ReturnType!(foo).max); } ----------------------------------------------------------- I expected to get a compiler error here. Is this a DMD bug?
Comment #1 by destructionator — 2018-04-18T17:17:59Z
It is illegal to overload based on return value, I don't think it should allow that definition at all.
Comment #2 by simen.kjaras — 2018-04-19T20:30:43Z
*** This issue has been marked as a duplicate of issue 7549 ***