D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3675 - Regression: Struct literals cannot be initialized with another struct literal
Summary: Regression: Struct literals cannot be initialized with another struct literal
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 regression
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
 
Reported: 2010-01-05 01:14 UTC by Don
Modified: 2015-06-09 01:26 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Don 2010-01-05 01:14:34 UTC
Worked in DMD2.034, fails on 2.035 and later.
And where the heck did the type int come from???
----
struct CopyTest
{
   double x;
}

enum CopyTest z = CopyTest(5.3);
enum CopyTest w = z;
------
bug.d(6): Error: cannot implicitly convert expression ((CopyTest)(5.3)) of type int to CopyTest
Comment 1 Don 2010-01-05 04:38:28 UTC
ROOT CAUSE: This was a bug in my patch to bug 3190.

PATCH:
expression.c, DsymbolExp::semantic(), line 2359.

	if ((v->storage_class & STCmanifest) && v->init)
	{
	    e = v->init->toExpression();
-	    e->semantic(sc);
+	    e = e->semantic(sc);
	    return e;
	}
Comment 2 Walter Bright 2010-01-11 22:03:45 UTC
Changeset 332
Comment 3 Walter Bright 2010-01-30 22:47:00 UTC
fixed dmd 2.040