D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 14556 - [REG2.067] can't instantiate struct that has constructor and static array of enum
Summary: [REG2.067] can't instantiate struct that has constructor and static array of ...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords: pull, rejects-valid
: 14764 (view as issue list)
Depends on:
Blocks:
 
Reported: 2015-05-07 22:18 UTC by ag0aep6g
Modified: 2015-07-21 12:53 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description ag0aep6g 2015-05-07 22:18:48 UTC
----
enum E {a = 1}

struct OnlyResult
{
    this(E) {}
    E[1] data;
}

void main()
{
    auto o = OnlyResult(E.a); /* line 11 */
}
----

Compiles fine with 2.066.1 and older.
With 2.067.0 and later:
"test.d(11): Error: cannot implicitly convert expression (0) of type int to E[1]"

Discovered by Nick Sabalausky in D.learn:
http://forum.dlang.org/post/migjge$eat$1@digitalmars.com
Comment 1 Vladimir Panteleev 2015-05-08 07:29:27 UTC
Introduced in  https://github.com/D-Programming-Language/dmd/pull/3885
Comment 2 ag0aep6g 2015-05-08 22:13:09 UTC
Same problem with static array of void:

----
struct OnlyResult
{
    this(int) {}
    void[1] data;
}

void main()
{
    auto o = OnlyResult(0);
}
----
Comment 4 github-bugzilla 2015-06-04 08:58:17 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/3cde9f06d19ceb39efb0fcf0febd157b21e2c6b4
fix Issue 14556 - can't instantiate struct that has constructor and static array of enum

https://github.com/D-Programming-Language/dmd/commit/920d18e560e9669e6400c5b29c7c40d78b562fdb
Merge pull request #4706 from 9rnsr/fix14556

[REG2.067] Issue 14556 - can't instantiate struct that has constructor and static array of enum
Comment 5 github-bugzilla 2015-06-17 21:05:37 UTC
Commits pushed to stable at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/3cde9f06d19ceb39efb0fcf0febd157b21e2c6b4
fix Issue 14556 - can't instantiate struct that has constructor and static array of enum

https://github.com/D-Programming-Language/dmd/commit/920d18e560e9669e6400c5b29c7c40d78b562fdb
Merge pull request #4706 from 9rnsr/fix14556
Comment 6 Martin Nowak 2015-07-21 12:53:49 UTC
*** Issue 14764 has been marked as a duplicate of this issue. ***