<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Clang rejects deleted defaulted noexcept default constructor"
   href="https://bugs.llvm.org/show_bug.cgi?id=33550">33550</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang rejects deleted defaulted noexcept default constructor
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>billy.oneal@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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 (
<a href="https://wandbox.org/permlink/b40YJn7QwRprgdTp">https://wandbox.org/permlink/b40YJn7QwRprgdTp</a> ) , 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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>