Skip to content
Snippets Groups Projects
Commit acd679a7 authored by Iain Buclaw's avatar Iain Buclaw
Browse files

d: Fix PR 108842: Cannot use enum array with -fno-druntime

Restrict the generating of CONST_DECLs for D manifest constants to just
scalars without pointers.  It shouldn't happen that a reference to a
manifest constant has not been expanded within a function body during
codegen, but it has been found to occur in older versions of the D
front-end (PR98277), so if the decl of a non-scalar constant is
requested, just return its initializer as an expression.

	PR d/108842

gcc/d/ChangeLog:

	* decl.cc (DeclVisitor::visit (VarDeclaration *)): Only emit scalar
	manifest constants.
	(get_symbol_decl): Don't generate CONST_DECL for non-scalar manifest
	constants.
	* imports.cc (ImportVisitor::visit (VarDeclaration *)): New method.

gcc/testsuite/ChangeLog:

	* gdc.dg/pr98277.d: Add more tests.
	* gdc.dg/pr108842.d: New test.

(cherry picked from commit f934c575)
parent 45e950b5
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment