[LLVMbugs] [Bug 18756] New: Overzealous warning about C-linkage for complex<double>

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 6 09:42:20 PST 2014


            Bug ID: 18756
           Summary: Overzealous warning about C-linkage for
           Product: clang
           Version: 3.4
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: schnetter at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

In a project containing C, C++, and Fortran code, we have wrapper routines for
complex numbers. These essentially map to complex<double> for C++, complex
double for C, and complex*16 for Fortran, relying on the fact that these types
all have the same internal representation.

Clang reports a warning for the C++ routines, as if the standard did not
guarantee this layout between C and C++. Here is a simplified example code:

$ cat complex2.cc
#include <complex>
extern "C" std::complex<double> f();

This leads to the warning:

$ clang++ -c complex2.cc
complex2.cc:2:33: warning: 'f' has C-linkage specified, but returns
      type 'std::complex<double>' which is incompatible with C
extern "C" std::complex<double> f();
1 warning generated.

I believe this warning should be omitted for complex<double>, since the C++
standard guarantees that this type is actually compatible with C.

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/20140206/b4a90750/attachment.html>

More information about the llvm-bugs mailing list