www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6500] New: Show template instantiation values too


           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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc

--- Comment #0 from bearophile_hugs 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() {
    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:

Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 15 2011