[LLVMdev] Why is "typedef boost::shared_ptr<MyClass> MyClass_ptr" named "struct.boost::MyClass_ptr" by llvm-g++?

David Eriksson twogood at users.sourceforge.net
Wed Nov 19 03:11:38 PST 2008


Hi,

In the code below, MyNamespace::MyClass_ptr will be named
"struct.boost::MyClass_ptr" by llvm-g++, and not
"struct.MyNamespace::MyClass_ptr" as I expected. 

I observed this with the real boost::shared_ptr but used the code below
(also attached as structnametest1.cc) on the demo page
(http://llvm.org/demo/index.cgi) to reproduce the behavior.

When I extended my test code to create a MyClass and MyClass_ptr in the
boost namespace too, it seems like both struct:s get called
"struct.boost::MyClass_ptr". (Attached as structnametest2.cc)

I have a suspicion that this is not the desired behavior. Is there
somewhere in llvm-gcc I could look to see if it's an easy patch, or
something else to do before I file a bug report?


Best regards,

David Eriksson


namespace boost
{
template<typename T>
class shared_ptr
{
  private:
    T* p_;
    void* q_;
  public:
    shared_ptr(T*p) :
      p_(p)
    {
    }
};
} // namespace boost

namespace MyNamespace
{
class MyClass
{
};
typedef boost::shared_ptr<MyClass> MyClass_ptr;
} // namespace MyNamespace

MyNamespace::MyClass_ptr func()
{
  return MyNamespace::MyClass_ptr(new MyNamespace::MyClass());
}

-- 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: structnametest1.cc
Type: text/x-c++src
Size: 393 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20081119/6ac60287/attachment.cc>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: structnametest2.cc
Type: text/x-c++src
Size: 546 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20081119/6ac60287/attachment-0001.cc>


More information about the llvm-dev mailing list