Bug 12967 – Prefix method 'this' qualifiers should be disallowed in DeclDefs scope

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-06-23T06:21:00Z
Last change time
2014-10-04T05:31:01Z
Keywords
pull
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2014-06-23T06:21:35Z
Currently following three function declarations are compiled successfully. const void prefix_f() {} const { void block_f() {} } const: void label_f() {} But postfix stype method qualifier is disallowed. void postfix_f() const {} // Error: function test.postfix_f without 'this' cannot be const This is introduced by fixing issue 10150. There's pragmatic reason to accept block and label style. const { // or label style int var = 123; // qualified with const ... many variable declarations -> qualified with const void foo() {} // just ignoring 'const' is useful than making error ... more variable declarations -> qualified with const } So I think that above behavior should be kept as-is. But prefix style attributes always modify only one declaration. So it would be more consistent behavior that raising same error in both prefix and postfix cases. const void prefix_f() {} void postfix_f() const {} // Error: function test.prefix_f without 'this' cannot be const // Error: function test.postfix_f without 'this' cannot be const
Comment #1 by k.hara.pg — 2014-06-23T15:13:16Z
Comment #2 by github-bugzilla — 2014-06-26T09:49:19Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/69302730c054f35d7ad206054f96db723cbf12cd fix Issue 12967 - Prefix method 'this' qualifiers should be disallowed in DeclDefs scope https://github.com/D-Programming-Language/dmd/commit/9521bfc5abc636910ba0bcc085bca3bf46b854a5 Merge pull request #3689 from 9rnsr/fix12967 Issue 12967 - Prefix method 'this' qualifiers should be disallowed in DeclDefs scope
Comment #3 by k.hara.pg — 2014-10-04T05:31:01Z
*** Issue 10482 has been marked as a duplicate of this issue. ***