[Issue 1221] New: Incorrect template return value

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 8 10:33:43 PDT 2007


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 at digitalmars.com
        ReportedBy: onlystupidspamhere at 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!());


-- 



More information about the Digitalmars-d-bugs mailing list