[Issue 20730] New: [REG 2.091] Template instantiation errors after any real errors
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Apr 12 11:45:58 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20730
Issue ID: 20730
Summary: [REG 2.091] Template instantiation errors after any
real errors
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ibuclaw at gdcproject.org
Caused by: https://github.com/dlang/dmd/pull/10711
Test:
---
import xstd.stdio;
void test21()
{
auto f = File().byLine;
}
void main()
{
test23();
}
---
---
T atomicOp(string op, T, V1)(ref shared T val, V1 mod)
if (__traits(compiles, mixin("*cast(T*)&val" ~ op ~ "mod")))
{
return val;
}
struct File
{
shared uint refs;
this(this)
{
atomicOp!"+="(refs, 1);
}
struct ByLineImpl(Char)
{
File file;
char[] line;
}
auto byLine()
{
return ByLineImpl!char();
}
}
---
Expected output:
---
Error: undefined identifier `test23`, did you mean function `test21`?
---
Actual output:
---
Error: undefined identifier `test23`, did you mean function `test21`?
Error: template `stdio.atomicOp` cannot deduce function from argument types
`!("+=")(shared(uint), int)`, candidates are:
xstd/stdio.d(1): `atomicOp(string op, T, V1)(ref shared T val, V1 mod)`
with `op = "+=",
T = uint,
V1 = int`
must satisfy the following constraint:
` __traits(compiles, mixin("*cast(T*)&val" ~ op ~ "mod"))`
---
Fixing the first error makes the template instantiation error go away.
--
More information about the Digitalmars-d-bugs
mailing list