<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 --- - Block scope function declaration in class member function definition ignores linkage specification"
href="http://llvm.org/bugs/show_bug.cgi?id=19411">19411</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Block scope function declaration in class member function definition ignores linkage specification
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.4
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>hstong@ca.ibm.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Clang does not honour linkage specifications in determining (at least) the
language linkage of the name of a function declared at block scope in a member
function definition.
GCC and ICC work as expected.
C++03 3.5 [basic.link] paragraph 6:
The name of a function declared in block scope [ . . . ] [has] linkage. [ . . .
] [The] block scope entity receives external linkage.
C++03 7.5 [dcl.link] paragraph 4:
In a linkage-specification, the specified language linkage applies to the
function types of all function declarators, function names, and variable names
introduced by the declaration(s).
### SOURCE:
<span class="quote">> cat blockscopeextC.cc </span >
struct A { void foo(); };
extern "C" void A::foo() { void bar(int); bar(0); }
Return: 0x00:0
### COMPILER INVOCATION AND RESULT:
<span class="quote">> clang++ blockscopeextC.cc -c && nm blockscopeextC.o</span >
U _Z3bari
0000000000000000 D _ZN1A3fooEv
Return: 0x00:0
### EXPECTED RESULT:
U bar
0000000000000000 D _ZN1A3fooEv
### clang++ -v:
<span class="quote">> clang++ -v</span >
clang version 3.4 (tags/RELEASE_34/final)
Target: powerpc64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/ppc64-redhat-linux/4.4.4
Found candidate GCC installation: /usr/lib/gcc/ppc64-redhat-linux/4.4.6
Selected GCC installation: /usr/lib/gcc/ppc64-redhat-linux/4.4.6
Return: 0x00:0</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>