[LLVMbugs] [Bug 8526] New: anonymous namespace prevents codegen outside namespace

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 2 00:09:06 PDT 2010


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

           Summary: anonymous namespace prevents codegen outside namespace
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: skabet at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


$ clang++ --version
clang version 2.9 (trunk 118011)
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ clang++ -c bug.cpp -o out.o && nm out.o
$
(empty output)

$ cat bug.cpp
namespace { // removing namespace makes it work
  class Inner {
  };
}

template<class D>
class _Outer{

public:
  _Outer() {}
};

typedef _Outer<Inner> Outer;

class Foo {
public:
  Outer bar() const;
};

Outer Foo::bar() const { // not emited. "nm out.o" is empty
  return Outer(); 
}

============

As seen, Foo::bar is not emited. Removing the anonymous namespace makes it
work. Changing the return type (Outer) to something not related the the
anonymous namespace also makes it work.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list