Bug 8154 – Source of error is hidden when using default-parametrized tempalte-struct

Status
RESOLVED
Resolution
INVALID
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-05-27T05:50:00Z
Last change time
2012-10-21T14:06:41Z
Keywords
diagnostic
Assigned to
nobody
Creator
dmitry.olsh

Comments

Comment #0 by dmitry.olsh — 2012-05-27T05:50:12Z
struct Policy{} struct Bogus(CT=Policy) { this(int dummy) { _r = 1; } } Bogus a; void main(){} dmd from git commit 54056a901cd78410b96cb9bff245c231e6d6f71e outputs: bug3.d(11): Error: struct bug3.Bogus(CT = Policy) is used as a type
Comment #1 by dmitry.olsh — 2012-05-27T05:52:04Z
the real problem is seen if replaced with: Bogus!Policy a; bug3.d(7): Error: undefined identifier _r, did you mean variable a? That's what I'd expect with default instantation too.
Comment #2 by andrej.mitrovich — 2012-10-21T14:06:41Z
You didn't actually instantiate it the first time: This: Bogus a; Needs to be: Bogus!() a; It's unfortunate D doesn't allow the first case to work though.. but that's probably another bug report.