https://llvm.org/bugs/show_bug.cgi?id=30689

            Bug ID: 30689
           Summary: Missing destructor on inner structure when initialized
                    using initializer list
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangb...@nondot.org
          Reporter: valery.pykh...@gmail.com
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
    Classification: Unclassified

The following testcase fails to compile with ToT clang:


template <typename T>
class UP {
public:
  T *p;
  UP() : p(0) {}
  UP(T* _p) : p(_p) {}
  ~UP() { delete p; }
};

typedef struct Inner
{
  UP<double> a;
} Inner;

typedef struct Outer
{
  Inner      inner;
  UP<double> b;
} Outer;

int main(void) {
//  UP<Outer> p(new Outer()); // <-- This works!
  UP<Outer> p(new Outer{}); // <-- This fails!
  return 0;
}



> clang++ -std=c++11 test.cpp
/tmp/test-a1fad6.o: In function `main':
test.cpp:(.text+0x94): undefined reference to `Inner::~Inner()'
/tmp/test-a1fad6.o: In function `Outer::~Outer()':
test.cpp:(.text._ZN5OuterD2Ev[_ZN5OuterD2Ev]+0x28): undefined reference to
`Inner::~Inner()'
clang-4.0: error: linker command failed with exit code 1 (use -v to see
invocation)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to