Bug 15490 – [REG 2.067] Error variable __nrvoretval cannot be modified at compile time when using -inline
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-12-31T19:16:00Z
Last change time
2016-02-23T10:04:29Z
Assigned to
nobody
Creator
ibuclaw
Comments
Comment #0 by ibuclaw — 2015-12-31T19:16:13Z
Code:
---
void main()
{
import std.regex;
Regex!(char) pattern;
pattern = regex("");
import vibe.core.net;
void metricReceiver(TCPConnection) { }
listenTCP(1, conn => metricReceiver(conn), "2");
}
---
Command line (sorry haven't reduced beyond own project):
---
dmd -c -inline -version=VibeUseNativeDriverType -version=VibeLibasyncDriver -I../../../.dub/packages/vibe-d-0.7.26/source/ -I../../../.dub/packages/libasync-0.7.5/source/ -I../../../.dub/packages/memutils-0.4.3/source/
---
Output:
---
Using Linux EPOLL for events
Error: variable __nrvoretval4587 cannot be modified at compile time
/usr/include/dmd/phobos/std/regex/package.d(333): called from here: regex("^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.|$)){4}$", "")
/usr/include/dmd/phobos/std/regex/package.d(355): Error: template instance std.regex.ctRegexImpl!("^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.|$)){4}$", "") error instantiating
../../../.dub/packages/vibe-d-0.7.26/source/vibe/core/drivers/libasync.d(197): instantiated from here: ctRegex!("^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.|$)){4}$", "")
Error: variable __nrvoretval4587 cannot be modified at compile time
/usr/include/dmd/phobos/std/regex/package.d(333): called from here: regex("^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.|$)){4})$", "")
/usr/include/dmd/phobos/std/regex/package.d(355): Error: template instance std.regex.ctRegexImpl!("^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.|$)){4})$", "") error instantiating
../../../.dub/packages/vibe-d-0.7.26/source/vibe/core/drivers/libasync.d(198): instantiated from here: ctRegex!("^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.|$)){4})$", "")
---
Workaround:
---
Remove -inline flag
---
Comment #1 by ibuclaw — 2015-12-31T19:25:59Z
Doesn't happen if I switch from 2.069 to 2.068
Comment #2 by ag0aep6g — 2016-01-01T13:23:31Z
Reduced:
main.d:
----
module main;
import imp1;
import imp2;
void main()
{
regex();
listenTCP();
}
----
imp1.d:
----
module imp1;
import imp2;
void listenTCP()
{
enum r = regex();
}
----
imp2.d:
----
module imp2;
int regex()
{
return regexImpl();
}
auto regexImpl()
{
int r = 0;
return r;
}
----
`dmd -c main.d` works. `dmd -c -inline main.d` gives:
----
Error: variable __nrvoretval51 cannot be modified at compile time
imp1.d(7): called from here: regex()
----
This reduction fails with 2.068 and 2.067, too. But it compiles with 2.066.
Comment #3 by ibuclaw — 2016-01-03T21:07:10Z
(In reply to ag0aep6g from comment #2)
> Reduced:
>
> This reduction fails with 2.068 and 2.067, too. But it compiles with 2.066.
Thanks alot!
Yes, I have been seeing the error occur in 2.068 too after splitting components of the project into packages.
I have an idea what was the bad commit, will give it a bisect.