D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2828 - Typedef'ed template struct incorrectly recognized as an inner struct
Summary: Typedef'ed template struct incorrectly recognized as an inner struct
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 All
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
 
Reported: 2009-04-10 02:11 UTC by Sönke Ludwig
Modified: 2015-06-09 01:18 UTC (History)
2 users (show)

See Also:


Attachments
Remove incorrect cast, resolve basetype. (670 bytes, patch)
2009-04-11 14:57 UTC, Unknown W. Brackets
Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description Sönke Ludwig 2009-04-10 02:11:13 UTC
The following code fragment errors out with

---
bug_innerstruct.d(3): Error: struct bug_innerstruct.Test inner struct MyVariant
cannot be a field
---

Changing typedef to alias makes the code compile again.

---
struct Variant(T...) { T members; }
typedef Variant!(int, float) MyVariant;
struct Test { MyVariant v; }
---
Comment 1 Unknown W. Brackets 2009-04-11 14:57:09 UTC
Created attachment 321 [details]
Remove incorrect cast, resolve basetype.

This patch fixes it, so it acts just like an alias, by resolving the base type.

The intended check still works, this just resolves the TypedefDeclaration to a StructDeclaration.  I also removed the cast in favor of the safer isStructDeclaration().

-[Unknown]
Comment 2 Don 2010-11-16 04:59:58 UTC
Fixed svn 614.