Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Ticket #400 (new defect)

Opened 2 years ago

Last modified 2 years ago

Regression: "type C is not an expression" when referencing an aliased struct-valued template through an aggregate type

Reported by: Deewiant Assigned to: lindquist
Priority: major Milestone:
Component: frontend (D1 only) Version: hg tip
Keywords: Cc:

Description

struct S { uint x; }

template MakeS(uint x) { const MakeS = S(x); }

struct S2 { alias .MakeS MakeS; }

void f() {
	S2 s2;
	auto n = S2.MakeS!(0); //////////// XXX
}

The above code (the workaround for #397...) works with DMD 1.056, but not with latest LDC:

$ ldc -c arst.d
arst.d(9): Error: type S2 is not an expression
$ ldc --version
LLVM D Compiler rev. 1636:332925de1881 (2010-03-08 17:44 +0100)
based on DMD v1.056 and llvm 2.6 (Wed Jan  6 00:51:49 2010)
$ dmd -c arst.d
$ dmd | head   
Digital Mars D Compiler v1.056

Change History

03/14/10 05:28:00 changed by ChristianK

This is related to our fix to http://d.puremagic.com/issues/show_bug.cgi?id=2682 . It seems DMDFE creates an invalid semantic tree and then folds it back into a valid state. We have disabled some invalid (and also some valid) struct literal constant folds and thereby leave the AST in a broken state.

If you disable our fix by making VarExp::isSameAsInitializer the same as VarExp::isConst, this test case passes, but DMDFE2682 is broken again.

Compare #218, #324, the current fix [df11cdec45a2] and its history [ab186e535e72], [c519caae3181].

Copyright © 2008, LDC Development Team.