www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 468] New: argument wrongfully identified as type in template instantiation

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=468

           Summary: argument wrongfully identified as type in template
                    instantiation
           Product: D
           Version: 0.172
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: roel.mathys gmail.com


compile this:

template check( char ch1 
                          , char ch2)
{
        const bool check = ch1 == ch2;
}        

import std.stdio;
void main() 
{ 
        const char[] s = "123+456" ;
        writefln( check!( '+', s[3] ));
}

adding parentheses around s, e.g. (s)[3] let's the thing compile.


-- 
Oct 28 2006
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com schrieb am 2006-10-28:
 http://d.puremagic.com/issues/show_bug.cgi?id=468
 compile this:

 template check( char ch1 
                           , char ch2)
 {
         const bool check = ch1 == ch2;
 }        

 import std.stdio;
 void main() 
 { 
         const char[] s = "123+456" ;
         writefln( check!( '+', s[3] ));
 }

 adding parentheses around s, e.g. (s)[3] let's the thing compile.
test cases: http://dstress.kuehne.cn/run/t/template_23_A.d http://dstress.kuehne.cn/run/t/template_23_B.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFZX19LK5blCcjpWoRAjjMAJ0eLZjZYEGZa/KFCImK70RmA1WR6wCeMlEh TIeHVVWktdIAVzt0fcYHMFM= =0Mmg -----END PGP SIGNATURE-----
Nov 23 2006
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=468


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





Fixed DMD 0.175


-- 
Nov 25 2006