Variable shadowing bug?

denizzz 4.deniz.z.z at gmail.com
Tue Jun 11 01:08:02 PDT 2013


Piece of code:
https://github.com/denizzzka/DSFML/blob/237a752988c76e3c2f63ed03ae12558823ce43ec/dsfml/system.d#L53

============================
	Time getElapsedTime() const
	{
		auto r = sfClock_getElapsedTime(sfPtr);
		static assert( is (typeof(r) == sfTime) ); // added for debug
		return Time(r);
	}

[...]

struct sfTime // accidentally defined below in this file
{
	long microseconds;
}
============================

sfClock_getElapsedTime return type actually defined in the 
another file, typeid = 
_D45TypeInfo_S8derelict5sfml211systemtypes6sfTime6__initZ

compilation causes:

dsfml/system.d(54): Error: static assert  (is(sfTime == sfTime)) 
is false

This message looks weird. I am spent hour to find this bug. :-(


More information about the Digitalmars-d-learn mailing list