D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3686 - common type of imaginary and non-imaginary should be complex
Summary: common type of imaginary and non-imaginary should be complex
Status: RESOLVED WONTFIX
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-07 12:32 UTC by Ellery Newcomer
Modified: 2017-07-21 07:18 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Ellery Newcomer 2010-01-07 12:32:48 UTC
import std.stdio;
string s(string t1, string t2){
        return "writeln(\"" ~ t1 ~ " " ~ t2 ~ " \"~ typeof(true ? cast(" ~ t1 ~ ") 1 : cast(" ~ t2 ~ ") 1).stringof);\n";
}
void main()
{
        mixin(s("ifloat","double"));
}


result of above code doesn't make sense to me. if something like

auto a = true ? 1i : 1;

is allowed, it seems the result type should be complex; not imaginary, and not real.

I'm also curious why combining a char with a wchar or some such results in a uint
Comment 1 yebblies 2011-07-02 23:16:24 UTC
char and wchar both implicitly convert to int, so that is expected behavior.

The common type of float and ifloat etc should of course be cfloat.  etc

https://github.com/D-Programming-Language/dmd/pull/198
Comment 2 yebblies 2012-02-01 17:51:32 UTC
Imaginary and complex numbers are going away.
Comment 3 Vladimir Panteleev 2017-07-21 07:18:30 UTC
Closing as per Don's comment on Daniel's pull request ( https://github.com/dlang/dmd/pull/198#issuecomment-1492958 ), and because the built-in complex number types are going away ( http://dlang.org/deprecate#Imaginary%20and%20complex%20types ).