http://llvm.org/bugs/show_bug.cgi?id=18756
Bug ID: 18756
Summary: Overzealous warning about C-linkage for
complex<double>
Product: clang
Version: 3.4
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
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
user-defined
type 'std::complex<double>' which is incompatible with C
[-Wreturn-type-c-linkage]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs