[LLVMbugs] [Bug 18741] New: Incorrect error message when attempting to overload within extern "C" block

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Feb 5 09:17:53 PST 2014


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

            Bug ID: 18741
           Summary: Incorrect error message when attempting to overload
                    within extern "C" block
           Product: clang
           Version: 3.3
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: continuation at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Compiling the following program with clang 3.3 (and 3.5 somebody told me):

extern "C" {
  void Foo(void *arg1) {
  }
  bool Foo(void *arg1, void *arg2) {
    return true;
  }
}

...produces the error message "error: functions that differ only in their
return type cannot be overloaded".  This is confusing, because of course they
do not differ only in their return type.  I think the actual reason the
overloading is not allowed is that it is within an extern "C" block. (I
originally hit this in a large header file where I didn't realize the function
was in an extern "C" block.)

If the second Foo is changed to have a return type void, then you get the error
message "error: conflicting types for 'Foo'", which still doesn't mention that
types only conflict because of the extern "C" block, but at least it isn't
wrong.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140205/bd8e4394/attachment.html>


More information about the llvm-bugs mailing list