[LLVMbugs] [Bug 19411] New: Block scope function declaration in class member function definition ignores linkage specification

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Apr 12 07:02:38 PDT 2014


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

            Bug ID: 19411
           Summary: Block scope function declaration in class member
                    function definition ignores linkage specification
           Product: clang
           Version: 3.4
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hstong at ca.ibm.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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:
> cat blockscopeextC.cc 
struct A { void foo(); };
extern "C" void A::foo() { void bar(int); bar(0); }
Return:  0x00:0


### COMPILER INVOCATION AND RESULT:
> clang++ blockscopeextC.cc -c && nm blockscopeextC.o
                 U _Z3bari
0000000000000000 D _ZN1A3fooEv
Return:  0x00:0


### EXPECTED RESULT:
                 U bar
0000000000000000 D _ZN1A3fooEv


### clang++ -v:
> clang++ -v
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

-- 
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/20140412/96dceeb0/attachment.html>


More information about the llvm-bugs mailing list