[Issue 8220] invalid function call not detected during semantic analysis

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 14 00:49:18 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8220



--- Comment #4 from Kenji Hara <k.hara.pg at gmail.com> 2012-06-14 00:51:28 PDT ---
(In reply to comment #3)
> Created an attachment (id=1115) [details]
> failing test case

I think this test case is not correct code.

(From test case)
> alias typeof(Length*Length) 		Area;
> alias typeof(Length*Area) 		Volume;
> alias typeof(Mass/Volume) 		Density;
> alias typeof(Length*Mass/Time/Time) 	Force;
> alias typeof(1/Time) 			Frequency;
> alias typeof(Force/Area) 		Pressure;
> alias typeof(Force*Length) 		Energy;
> alias typeof(Energy/Time) 		Power;
> alias typeof(Time*Current) 		Charge;
> alias typeof(Power/Current) 		Voltage;
> alias typeof(Charge/Voltage) 		Capacitance;
> alias typeof(Voltage/Current) 		Resistance;
> alias typeof(1/Resistance) 		Conductance;
> alias typeof(Voltage*Time) 		MagneticFlux;
> alias typeof(MagneticFlux/Area) 	MagneticFluxDensity;
> alias typeof(MagneticFlux/Current) 	Inductance;
> alias typeof(Intensity*UnitLess) 	LuminousFlux;
> alias typeof(LuminousFlux/Area) 	Illuminance;

As far as I know, normal expressions cannot take Type as their operands, even
if it is defined by operator overloading.

 struct S { void opMul(S s){} }
 S + S;   // this is INVALID code

This rule should be applied even in typeof expression, then
typeof(Length*Length) must be invalid.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list