[LLVMbugs] [Bug 12624] New: Clang error when trying to printf the value of a void function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Apr 22 14:19:17 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12624

             Bug #: 12624
           Summary: Clang error when trying to printf the value of a void
                    function
           Product: clang
           Version: 3.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: adriafarres at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8425
  --> http://llvm.org/bugs/attachment.cgi?id=8425
Terminal's output

Basically, when trying to printf a void function, it leads to an error. The
code to reproduce the error is:
-------
#include <stdio.h>

void add(int n);

int main()
{
    int p=5;
    printf("%d", add(p));
    return 0;
}

void add(int n)
{
    n++;
}
-------
I attach both the output of Clang in the terminal and the diagnostic of the
preprocessor, though you will probably be able to reproduce it.

GCC's output is as simple as:

file.c:8:2: error: invalid use of void expression.

I think there is nothing else hidden in the code. I'm not an experienced
programmer, so it is a simple error.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list