Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Is this GNU fix valid for newer versions of D?

Moderators: kris

Posted: 02/28/10 17:16:03

Inside 'tango/core/Traits.d' their is a GNU specific version for isStaticArrayType. Using a newer GDC updated to D 1.045 it gives a template instantiantion error. Since the version of GDC I have been using is based on dmd 1.030, I am curious is something in a newer version would have made the statement illegal. If not then I would need to investigate further and create a ticket for it on the GDC bug tracker. I was able to change it to version( none ) and compile the normal version of the template.

Because tango-0.99.9 doesn't fully support GDC and windows, I'm using tango-0.99.8 but the code is identical for both, just the line numbers are different.

216 	version( GNU )
217 	{
218 	    // GDC should also be able to use the other version, but it probably
219 	    // relies on a frontend fix in one of the latest DMD versions - will
220 	    // remove this when GDC is ready. For now, this code pass the unittests.
221 	    private template isStaticArrayTypeInst( T )
222 	    {
223 	        const T isStaticArrayTypeInst = void;
224 	    }
225 	
226 	    template isStaticArrayType( T )
227 	    {
228 	        static if( is( typeof(T.length) ) && !is( typeof(T) == typeof(T.init) ) )
229 	        {
230 	            const bool isStaticArrayType = is( T == typeof(T[0])[isStaticArrayTypeInst!(T).length] );
231 	        }
232 	        else
233 	        {
234 	            const bool isStaticArrayType = false;
235 	        }
236 	    }
237 	}

gives the error

/mingw/lib/gcc/mingw32/4.3.1/../../../../include/d/4.3.1\tango\core\Traits.d:223: Error: void initializer has no value
/mingw/lib/gcc/mingw32/4.3.1/../../../../include/d/4.3.1\tango\core\Traits.d:230: Error: Integer constant expression expected instead of 0.length
/mingw/lib/gcc/mingw32/4.3.1/../../../../include/d/4.3.1\tango\core\Traits.d:230: Error: Integer constant expression expected instead of 0.length
/mingw/lib/gcc/mingw32/4.3.1/../../../../include/d/4.3.1\tango\core\Traits.d:230: Error: Integer constant expression expected instead of 0.length
/mingw/lib/gcc/mingw32/4.3.1/../../../../include/d/4.3.1\tango\core\Variant.d:241: Error: template instance tango.core.Traits.isStaticArrayType!(char[]) error instantiating
Author Message

Posted: 02/28/10 18:24:09

I'd suggest posting a GDC bug

Posted: 03/01/10 03:11:03 -- Modified: 03/01/10 04:05:19 by
venix

Fails to compile with dmd v1.056 giving the same error messages.

That is, when I take the offending template code and try to compile it with dmd.