[llvm-bugs] [Bug 37862] New: call to implicitly-deleted default constructor

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 19 19:39:04 PDT 2018


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

            Bug ID: 37862
           Summary: call to implicitly-deleted default constructor
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zhonghao at pku.org.cn
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

The code is as follow:

template<typename T>
struct wrap
{
 wrap() = default;
 wrap(wrap&&) = default; // Line 5
 wrap(const wrap&) = default;

 T t;
};

struct S {
 S() = default;
 S(const S&){}
 S(S&&) = default;
};

typedef wrap<const S> W;

W get() { return W(); } // Line 19

int main() {}

clang++ rejects this code, and produces error messages:

error: call to implicitly-deleted default constructor of 'W' (aka 'wrap<const
S>')
    W get() { return W(); } // Line 19

Indeed, the code comes from a gcc bug report:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53733

A previous version of g++ also rejects the code, but is fixed. 

Please check the problem.

-- 
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/20180620/6c0a87d8/attachment.html>


More information about the llvm-bugs mailing list