[llvm-bugs] [Bug 41333] New: Inherited trivial default constructor is not trivial

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 1 08:06:03 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41333

            Bug ID: 41333
           Summary: Inherited trivial default constructor is not trivial
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++'17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: me at mgrech.dev
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Unless explicitly defaulted, a trivial default constructor inherited using
C++11's "inheriting constructors" feature is not considered trivial by clang if
the derived class has other constructors.

struct Base {};
struct Derived1 : Base {};
struct Derived2 : Base
{
    using Base::Base;
};
struct Derived3 : Base
{
    using Base::Base;
    Derived3(int) {}
};
struct Derived4 : Base
{
    Derived4() noexcept = default;
    Derived4(int) {}
};

Derived3 should be trivial but isn't, all other classes are trivial as
expected.
Example: https://gcc.godbolt.org/z/Wk4Yjk

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190401/4974182a/attachment-0001.html>


More information about the llvm-bugs mailing list