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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


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

Reply via email to