[LLVMbugs] [Bug 11387] New: template classes are never "trivial" in C++0x

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 15 12:20:24 PST 2011


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

             Bug #: 11387
           Summary: template classes are never "trivial" in C++0x
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: max at duempel.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


clang trunk r144645, libstdc++ 4.6.2.

A template class with an explicitly defaulted constructor is never "trivial"
according to std::is_trivial, even if the template argument is never used.

template<typename T> struct OK {};
template<typename T> struct Foo { Foo() = default; };
struct Bar { Foo<int> foo; };
#include <type_traits>
static_assert(std::is_trivial<OK<int>>::value, "OK");
static_assert(std::is_trivial<Foo<int>>::value, "Foo");
static_assert(std::is_trivial<Bar>::value, "Bar");

This succeeds for class "OK", because it does not have an explicit constructor.
Class "Foo" fails when it has a defaulted constructor, and so class "Bar" also
fails.

Related: Bug 11295, Bug 10442.

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