Bug 4920 – Member expression tuple allowed for types, disallowed for expressions

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-09-23T03:18:00Z
Last change time
2015-06-09T05:11:49Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
rsinfu

Attachments

IDFilenameSummaryContent-TypeSize
765member-tupleexp.patchPatch against dmd r680text/plain2111

Comments

Comment #0 by rsinfu — 2010-09-23T03:18:28Z
Created attachment 765 Patch against dmd r680 Alias to a non-type tuple can't be used as a member of struct or class. The following code doesn't compile. -------------------- struct Test(parameters_...) { alias parameters_ parameters; } Test!(10, 20, 30) test; static assert(typeof(test).parameters[1] == 20); // okay static assert( test .parameters[1] == 20); // (7) -------------------- % dmd -o- -c test.d test.d(7): Error: 10 is not a member test.d(7): Error: static assert ((__error) == (__error)) is false -------------------- DotVarExp::semantic() only allows tuple of member variables as a member. The proposed patch changes it so that other kinds of tuples are allowed. Passed dmd/druntime/phobos tests.
Comment #1 by k.hara.pg — 2012-06-01T02:03:38Z
Comment #2 by github-bugzilla — 2012-08-13T02:08:10Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/d2e632003437cbffcdcfbb82bdb2adb8003a9a49 fix Issue 4920 - Member expression tuple allowed for types, disallowed for expressions https://github.com/D-Programming-Language/dmd/commit/5590585d14e3664156063fb8ed414cfc56e5199a Merge pull request #973 from 9rnsr/fix4920 Issue 4920 - Member expression tuple allowed for types, disallowed for expressions
Comment #3 by k.hara.pg — 2012-08-19T02:26:36Z