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

           Summary: Fail to call destructor for explicitly created
                    temporary in function template
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


% cat leak.cc
#include <cstdio>

struct X {
  X()  { std::fprintf(stderr, "Constructing %p\n", this); }
  ~X() { std::fprintf(stderr, "Destructing %p\n", this); }
};

template <int N> void g() {
  (void)X();
}

int main() {
  (void)X();
  (void)g<1>();
  return 0;
}

% clang -o leak leak.cc && ./leak 
Constructing 0x7fff0c09a050
Destructing 0x7fff0c09a050
Constructing 0x7fff0c09a038

-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to