LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 22325 - Explicitly defaulted function on first declaration with incompatible exception-specification should be defined as deleted
Summary: Explicitly defaulted function on first declaration with incompatible exceptio...
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: C++11 (show other bugs)
Version: trunk
Hardware: All All
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-24 19:41 PST by Agustín Bergé
Modified: 2019-10-08 05:17 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Agustín Bergé 2015-01-24 19:41:22 PST
V-ille reports the following snippet is incorrectly rejected:

    struct Defaulted {
      Defaulted(Defaulted&&) noexcept(false) = default;
      int mem;
    };

with the following error:

    prog.cc:2:3: error: exception specification of explicitly defaulted move constructor does not match the calculated one Defaulted(Defaulted&&) noexcept(false) = default;

The move constructor should not be ill-formed, but deleted. This is CWG1778, exception-specification in explicitly-defaulted functions.
Comment 1 Anders Schau Knatten 2019-10-07 04:09:17 PDT
It seems that this was "fixed" some time between clang 8.0.0 and 9.0.0. Agustín's example now compiles: https://godbolt.org/z/7h5TuM

However, the handling of non-matching exception specifiers is still not correct. Non-matching exception specifiers should cause the function to be defined as deleted, which Clang fails to do: https://godbolt.org/z/qM3aRP.
Comment 2 ensadc 2019-10-07 14:24:56 PDT
The normative rule has changed. Now non-matching exception specifications do not cause the function to be deleted. See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1286r2.html.
Comment 3 Anders Schau Knatten 2019-10-08 05:17:47 PDT
Right, I wasn't aware of that change. Then I think we can close this issue.