mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-12 02:43:14 +01:00
The idea is to separate the notion of const from 'this variable can always be
replaced with its initializer' in the frontend. To do that, I introduced
Declaration::isSameAsInitializer, which is overridden in VarDeclaration to
return false for constants that have a struct literal initializer.
So
{{{
const S s = S(5);
void foo() { auto ps = &s; }
// is no longer replaced by
void foo() { auto ps = &(S(5)); }
}}}
To make taking the address of a struct constant with a struct-initializer
outside of function scope possible, I made sure that AddrExp::optimize doesn't
try to run the argument's optimization with WANTinterpret - that'd again
replace the constant with a struct literal temporary.
We have two different test sets. For the test drivers you need do compile the .d files in this folder with a Phobos D compiler. To run the 'mini' test suite run ./runminitests To run the DStress based tests execute ./runtest tmp-sensible-name and then use ./findregressions old-results new-results to display a list of regressions. You can download old result files from http://www.incasoftware.de/~kamm/ldc/reference