d: Don't set DECL_INITIAL if initializer is 'void'.
authorIain Buclaw <ibuclaw@gdcproject.org>
Tue, 23 Jun 2020 12:45:50 +0000 (14:45 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Thu, 25 Jun 2020 15:02:45 +0000 (17:02 +0200)
commiteacfafbc3534fb32782934d765d21855dff32e56
treec9e74913d431bb17f6a2b581d415849d60e4b2ac
parent6948c7c3d29bf5892299550a19ce615a85ef9b2b
d: Don't set DECL_INITIAL if initializer is 'void'.

Declarations initialized with `= void` were being default initialized.
That is not really the intent, and misses the small optimization that
should have been gained from using void initializations.

gcc/d/ChangeLog:

* decl.cc (DeclVisitor::visit (VarDeclaration *)): Don't set
DECL_INITIAL if initializer is 'void'.

gcc/testsuite/ChangeLog:

* gdc.dg/init1.d: New test.
gcc/d/decl.cc
gcc/testsuite/gdc.dg/init1.d [new file with mode: 0644]