Bug 9205 – Better error message for misplaced pure nothrow tags
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-12-25T01:52:55Z
Last change time
2022-01-18T21:22:11Z
Keywords
diagnostic
Assigned to
No Owner
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2012-12-25T01:52:55Z
void foo(T)(T x) if (is(T == int)) pure nothrow {
}
void main() {
foo(1);
}
Gives in DMD 2.061alpha:
test.d(1): Error: semicolon expected following function declaration
But I'd like that code to compile, or to give a simpler to understand error message, something like:
test.d(1): Error: 'pure nothrow' attributes of 'foo' must precede template constraint
Comment #1 by destructionator — 2022-01-18T21:22:11Z
This one is actually fixed, it now issues:
error.d(1): Error: 'pure' cannot be placed after a template constraint