[Issue 6500] New: Show template instantiation values too
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Aug 15 14:30:23 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6500
Summary: Show template instantiation values too
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: diagnostic
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2011-08-15 14:30:20 PDT ---
This enhancement is of minor priority.
A small C++ program:
template <int x>
int foo(int y) {
unsigned int z = 10;
return y < z;
}
int main() {
foo<5>(6);
return 0;
}
On it G++ 4.6 shows a warning, and it shows "x = 5" (the template instantiation
value) too:
...>g++ -Wall test.cpp -o test
test.cpp: In function 'int foo(int) [with int x = 5]':
test.cpp:7:13: instantiated from here
test.cpp:4:16: warning: comparison between signed and unsigned integer
expressions [-Wsign-compare]
I'd like DMD to do something similar, and show the template instatiation values
when it gives warnings:
int foo(int x)() {
return x;
static if (x > 10)
return x + 1;
}
int main() {
return foo!(12)();
}
DMD 2.054 gives:
test.d(4): Warning: statement is not reachable
This enhancement request applies to warnings like the signed/unsigned one in
pull 119 too:
https://github.com/D-Programming-Language/dmd/pull/119
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list