[LLVMbugs] [Bug 10302] New: unrestricted unions don't delete destructor when required

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 7 12:16:33 PDT 2011


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

           Summary: unrestricted unions don't delete destructor when
                    required
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: oneill+llvmbugs at cs.hmc.edu
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Created an attachment (id=6852)
 --> (http://llvm.org/bugs/attachment.cgi?id=6852)
unionbug.cpp — small example to show the bug

When an unrestricted union has a member with nontrivial destructor and no
explicit destructor is provided, the destrutor should be deleted, but clang
does not do so:

> clang++ -v
clang version 3.0 (trunk 133502)
Target: x86_64-apple-darwin10.8.0
Thread model: posix
> clang++ -Wall -std=c++0x -c unionbug.cpp
[no errors]

c.f.

> g++-mp-4.6 -std=c++0x -c unionbug.cpp
unionbug.cpp: In function 'int main()':
unionbug.cpp:16:39: error: use of deleted function
'NonTrivialDestructorInUnion::~NonTrivialDestructorInUnion()'
unionbug.cpp:8:7: error:
'NonTrivialDestructorInUnion::~NonTrivialDestructorInUnion()' is implicitly
deleted because the default definition would be ill-formed:
unionbug.cpp:11:29: error: union member 'NonTrivialDestructorInUnion::annoy'
with non-trivial 'HasNonTrivialDestructor::~HasNonTrivialDestructor()'

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