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
    Classification: Unclassified

The following testcase fails to compile with ToT clang:

template <typename T>
class UP {
  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
clang-4.0: error: linker command failed with exit code 1 (use -v to see

You are receiving this mail because:
You are on the CC list for the bug.
llvm-bugs mailing list

Reply via email to