Bug 17570 – Misleading error message illegal conditional function definition

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-06-29T05:03:07Z
Last change time
2018-02-17T13:15:38Z
Keywords
diagnostic
Assigned to
No Owner
Creator
Shachar Shemesh

Comments

Comment #0 by shachar — 2017-06-29T05:03:07Z
Consider the following program: import std.traits; struct S(T) { void func() if(isIntegral!T) { } } Currently, it produces the following error message: test.d(4): Error: semicolon expected following function declaration test.d(4): Error: declaration expected, not 'if' test.d(7): Error: } expected following members in struct declaration at test.d(3) The error message it should be producing is: test.d(4): Error: cannot use conditional definition for non-template functions. Use "static if" instead.
Comment #1 by razvan.nitu1305 — 2018-02-14T12:51:53Z
Comment #2 by github-bugzilla — 2018-02-17T13:15:38Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/4bf5a6b931b5075c08da7626a4eb8ba47dffb37c Fix Issue 17570 - Misleading error message illegal conditional function definition https://github.com/dlang/dmd/commit/59b705cb0b9402110a1da170d488e411b69aa9dc Merge pull request #7892 from RazvanN7/Issue_17570 Fix Issue 17570 - Misleading error message illegal conditional function definition merged-on-behalf-of: Mike Franklin <[email protected]>