www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2568] New: Warning Inside Template Causes Instantiation Error

reply d-bugmail puremagic.com writes:

           Summary: Warning Inside Template Causes Instantiation Error
           Product: D
           Version: 1.039
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: business3 twistedpairgaming.com

void foo(T)(T arg)
    int i = 999;
    byte b = i;

void main()
    float f;

The above code compiles correctly with warnings disabled. But when warnings are
enabled, an template instantiation error is generated:

warning - main.d(4): Error: implicit conversion of expression (i) of type int
to byte can cause loss of data
main.d(10): template instance main_.foo!(float) error instantiating

This might be related to #2567 and DMD's general treatment of warnings as

Jan 07 2009
parent d-bugmail puremagic.com writes:

yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |INVALID

--- Comment #1 from yebblies <yebblies gmail.com> 2011-06-10 06:40:33 PDT ---
In dmd 1.063 this no longer generates the error, but does cause the warning. 
The failed compilation is in line with dmd's treatment of errors.  The -wi
switch has since been introduced for the case you do not want to treat warnings
as error.

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