D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 12380 - Wrong line number for type mismatch with enum .init assignment
Summary: Wrong line number for type mismatch with enum .init assignment
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: diagnostic, pull
: 15867 20718 (view as issue list)
Depends on:
Blocks:
 
Reported: 2014-03-16 01:56 UTC by Andrej Mitrovic
Modified: 2022-12-10 13:56 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2014-03-16 01:56:20 UTC
-----
enum E { a, b, }  // L1

void main()
{
    void* a = E.init;  // L5
}
-----

$ dmd test.d
test.d(1): Error: cannot implicitly convert expression (cast(E)0) of type E to void*

Should be:
test.d(5): Error: cannot implicitly convert expression (cast(E)0) of type E to void*
Comment 2 github-bugzilla 2014-03-17 18:01:57 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/59cec6087c6b1b95164ba8e6baa35af042ffa57e
fix Issue 12380 - Wrong line number for type mismatch with enum .init assignment

https://github.com/D-Programming-Language/dmd/commit/f17dfa33873ebc7572d88720657ba3cc8d644d88
Merge pull request #3387 from 9rnsr/fix12380

Issue 12380 - Wrong line number for type mismatch with enum .init assignment
Comment 3 Andrej Mitrovic 2014-05-22 09:43:52 UTC
I've found another test-case which wasn't fixed by this pull:

-----
struct vec2 { float x, y; }

enum winSize = vec2(1024, 768);  // L3

void main()
{
    int x = winSize.x;  // L7
}
-----

test.d(3): Error: cannot implicitly convert expression (1024.00) of type float to int
Comment 4 Dlang Bot 2020-04-03 12:12:39 UTC
@BorisCarvajal created dlang/dmd pull request #11002 "Fix Issues 20718, 15867, 12380 - Wrong location errors on const. folding / exp. optimization" fixing this issue:

- Fix Issues 20718, 15867, 12380 - Wrong location errors on const. folding / exp. optimization

https://github.com/dlang/dmd/pull/11002
Comment 5 Steven Schveighoffer 2020-04-08 15:21:36 UTC
*** Issue 20718 has been marked as a duplicate of this issue. ***
Comment 6 Steven Schveighoffer 2020-04-08 15:21:56 UTC
*** Issue 15867 has been marked as a duplicate of this issue. ***
Comment 7 Dlang Bot 2020-05-06 09:48:35 UTC
dlang/dmd pull request #11002 "Fix Issues 20718, 15867, 12380 - Wrong location errors on const. folding / exp. optimization" was merged into stable:

- e9227fc44fdd52e7217d0f72f6fec671f98555f5 by Boris Carvajal:
  Fix Issues 20718, 15867, 12380 - Wrong location errors on const. folding / exp. optimization

https://github.com/dlang/dmd/pull/11002
Comment 8 Dlang Bot 2020-05-06 16:08:52 UTC
dlang/dmd pull request #11102 "Revert "Fix Issues 20718, 15867, 12380 - Wrong location errors on const. folding / exp. optimization"" was merged into stable:

- 7199de9b5d0a04bc415ac52d1490c66c92d14508 by Steven Schveighoffer:
  Revert "Fix Issues 20718, 15867, 12380 - Wrong location errors on const. folding / exp. optimization"

https://github.com/dlang/dmd/pull/11102
Comment 9 Steven Schveighoffer 2020-05-06 16:10:28 UTC
*** Issue 20718 has been marked as a duplicate of this issue. ***
Comment 10 Steven Schveighoffer 2020-05-06 16:10:47 UTC
*** Issue 15867 has been marked as a duplicate of this issue. ***
Comment 11 Dlang Bot 2020-05-09 07:14:20 UTC
@MartinNowak created dlang/dmd pull request #11118 "merge stable" fixing this issue:

- Fix Issues 20718, 15867, 12380 - Wrong location errors on const. folding / exp. optimization

- Merge pull request #11002 from BorisCarvajal/fix20718
  
  Fix Issues 20718, 15867, 12380 - Wrong location errors on const. folding / exp. optimization
  merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>

- Revert "Fix Issues 20718, 15867, 12380 - Wrong location errors on const. folding / exp. optimization"

- Merge pull request #11102 from dlang/revert-11002-fix20718
  
  Revert "Fix Issues 20718, 15867, 12380 - Wrong location errors on const. folding / exp. optimization"
  merged-on-behalf-of: Florian <moonlightsentinel@disroot.org>

https://github.com/dlang/dmd/pull/11118