[llvm-bugs] [Bug 33550] New: Clang rejects deleted defaulted noexcept default constructor

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 21 14:18:15 PDT 2017


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

            Bug ID: 33550
           Summary: Clang rejects deleted defaulted noexcept default
                    constructor
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: billy.oneal at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Consider the following:

template<class _Ty>
struct atomic {

        constexpr atomic(_Ty _Val) throw() // TRANSITION, VSO#174686
                : _My_val(_Val)
                {       // construct from _Val, initialization is not an atomic
operation
                }

        atomic() _NOEXCEPT = default;
        atomic(const atomic&) = delete;
        atomic& operator=(const atomic&) = delete;
        atomic& operator=(const atomic&) volatile = delete;

        _Ty _My_val;
};

struct non_default_ctor_able {
    non_default_ctor_able() = delete;
    explicit non_default_ctor_able(int) {}
    non_default_ctor_able(const non_default_ctor_able&) = default;
    non_default_ctor_able& operator=(const non_default_ctor_able&) = default;
    ~non_default_ctor_able() = default;
};

int main() {
    atomic<non_default_ctor_able> atm{non_default_ctor_able{42}};
    (void)atm;
};

C1XX, EDG, and GCC are all happy with this. Clang rejects (
https://wandbox.org/permlink/b40YJn7QwRprgdTp ) , saying:

prog.cc:9:2: error: exception specification of explicitly defaulted default
constructor does not match the calculated one
        atomic() noexcept = default;
        ^
prog.cc:26:35: note: in instantiation of template class
'atomic<non_default_ctor_able>' requested here
    atomic<non_default_ctor_able> atm{non_default_ctor_able{42}};
                                  ^
1 error generated.

-- 
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/20170621/4c794683/attachment.html>


More information about the llvm-bugs mailing list