www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19002] New: __FUNCTION__ and __PRETTY_FUNCTION__ are not C

https://issues.dlang.org/show_bug.cgi?id=19002

          Issue ID: 19002
           Summary: __FUNCTION__ and __PRETTY_FUNCTION__ are not C string
                    literals
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid, wrong-code
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: schveiguy yahoo.com

void main()
{
   import core.stdc.stdio;
   printf(__FUNCTION__); 
}

Error:  function core.stdc.stdio.printf(scope const(char*) format, ...) is not
callable using argument types (string)

__FUNCTION__ should be equivalent to a string literal here. Using __FILE__ or
__MODULE__ works fine.

--
Jun 18 2018