7190 – Tuple length incorrect

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7190 - Tuple length incorrect
Summary: Tuple length incorrect
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: patch, rejects-valid
Depends on:
Blocks:
Reported: 2011年12月31日 08:26 UTC by Robert Clipsham
Modified: 2017年07月19日 04:54 UTC (History)
1 user (show)

See Also:


Attachments
Files required to reproduce (1016 bytes, application/x-gzip)
2011年12月31日 08:26 UTC, Robert Clipsham
Details
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Robert Clipsham 2011年12月31日 08:26:53 UTC
Created attachment 1064 [details] 
Files required to reproduce
When compiling the attached code ( https://gist.github.com/7faf1013f81ea96bfb89
), the following error is given:
----
serenity/core/Model.d(2): Error: static assert "Article(1):
tuple((Article).id)"
example/models/HomeModel.d(10): instantiated from here:
SqlitePersister!(Article)
----
Note that the code requires the following directory/file layout:
serenity
 ` core
 ` Model.d
 ` Controller.d
example
 ` controllers
 ` HomeController.d
 ` models
 ` HomeModel.d
And should be compiled with:
dmd -c example/controllers/HomeController.d example/models/HomeModel.d
Comment 1 Kenji Hara 2012年01月01日 06:37:02 UTC
This is a forward reference bug.
Workaround in core/Model.d:
 class SqlitePersister(T) {
+ static assert(T.sizeof); // force running semantic of T
+ // to resolve sizeof property
 static assert(T.tupleof.length > 0, T.stringof ~ `(` ~ (T.tupleof.length
 + '0') ~ `): ` ~ T.tupleof.stringof);
 }
Comment 2 Kenji Hara 2012年01月01日 07:23:02 UTC
https://github.com/D-Programming-Language/dmd/pull/595 


AltStyle によって変換されたページ (->オリジナル) /