[Issue 23999] New: Potentially Ambiguous Template Instatiation
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jun 19 18:44:18 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=23999
Issue ID: 23999
Summary: Potentially Ambiguous Template Instatiation
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: critical
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: puneet at coverify.org
Currently, DMD allows variable declaration without whitespace after a template
instance that takes a string as a parameter. This leads to potentially
ambiguous code. Consider:
class Foo(string str) {
enum STR = str;
}
class Bar {
Foo!q{foo}bb;
Foo!q{foo}cc;
}
void main() {
Bar p;
pragma(msg, p.tupleof[0].stringof);
pragma(msg, p.tupleof[1].stringof);
}
// The compiler outputs:
//
// p.bb
// p.c
--
More information about the Digitalmars-d-bugs
mailing list