[LLVMbugs] [Bug 6671] New: Fail to call destructor for explicitly created temporary in function template

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 22 01:26:03 PDT 2010


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: unassignedclangbugs at nondot.org
        ReportedBy: chandlerc at gmail.com
                CC: llvmbugs at cs.uiuc.edu


% 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.



More information about the llvm-bugs mailing list