www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1221] New: Incorrect template return value

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

           Summary: Incorrect template return value
           Product: D
           Version: 1.014
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: onlystupidspamhere yahoo.se


Something weird happens here:

template foo() { const char[] foo = ""==null ? "" : ""; }

// Error: pragma msg string expected for message, not '"" == null ? "" : ""'
pragma(msg, foo!());

// Error: pragma msg string expected for message, not 'char[]'
pragma(msg, typeof(foo!()));

// But this works correctly
pragma(msg, typeof(foo!()).stringof); // prints 'char[]'

// Error: pragma msg string expected for message, not 'bar'
template bar() { const bar = ""==null ? "" : ""; }

// Error: pragma msg string expected for message, not 'char[0]'
pragma(msg, foo!());


-- 
May 08 2007
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1221


onlystupidspamhere yahoo.se changed:

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





The second pragma was invalid and the last one had a typo, but otherwise seems
to work now at least with dmd 1.021.


-- 
Sep 27 2007