<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Overzealous warning about C-linkage for complex<double>"
href="http://llvm.org/bugs/show_bug.cgi?id=18756">18756</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Overzealous warning about C-linkage for complex<double>
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.4
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>schnetter@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>