Bug 15878 – Discarding return value prevents inlining

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-04-05T13:04:46Z
Last change time
2018-11-24T11:24:36Z
Keywords
pull, rejects-valid
Assigned to
No Owner
Creator
Kenji Hara

Comments

Comment #0 by k.hara.pg — 2016-04-05T13:04:46Z
When a function has return value, discarding the value prevents inlining. pragma(inline, true) int foo() { return 0; } void main() { //int r = foo(); // OK foo(); // Error: function test.foo cannot inline function }
Comment #1 by k.hara.pg — 2016-04-05T13:13:33Z
Comment #2 by iamthewilsonator — 2018-11-24T11:15:52Z
Up to 2.063 : Failure with output: onlineapp.d(4): Error: pragma inline unrecognized pragma(inline) 2.064 to 2.067.1: Failure with output: onlineapp.d(1): Error: pragma inline unrecognized pragma(inline) Since 2.068.2: Success and no output
Comment #3 by stanislav.blinov — 2018-11-24T11:22:32Z
Did you add the -inline argument? I'm getting a different output: Up to 2.063 : Failure with output: onlineapp.d(4): Error: pragma inline unrecognized pragma(inline) 2.064 to 2.067.1: Failure with output: onlineapp.d(1): Error: pragma inline unrecognized pragma(inline) 2.068.2 to 2.070.2: Success and no output 2.071.2 to 2.074.1: Failure with output: onlineapp.d(2): Error: function onlineapp.foo cannot inline function Since 2.075.1: Success and no output Seeing the dance between 2.068 and 2.075, this probably needs to be made into a compiler test.
Comment #4 by iamthewilsonator — 2018-11-24T11:24:36Z
Whoops no I didn't. I agree.