http://llvm.org/bugs/show_bug.cgi?id=13733
Bug #: 13733
Summary: Implicit copy assignment mistakenly marked noexcept
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++11
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
This program fails to compile:
#include <iostream>
using namespace std;
struct annotate_t {
annotate_t() { cout << "default-ctor" << endl; }
~annotate_t() { cout << "dtor" << endl; }
annotate_t(const annotate_t&) noexcept(false) { cout << "copy-ctor" <<
endl; }
annotate_t(annotate_t&&) noexcept { cout << "move-ctor" << endl; }
// This is a pass-by-value assignment to avoid having to write it twice
annotate_t& operator=(annotate_t) noexcept { cout << "assign" << endl;
return *this; }
};
// The implicit move assignment is deleted on this type
struct pair_t {
int x_;
annotate_t y_;
};
static_assert(!noexcept(declval<pair_t&>() = declval<const pair_t&>()), "");
int main() {
}
static_assert(!noexcept(declval<pair_t&>() = declval<const pair_t&>()), "");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
I would expect it to compile because the implicit copy assignment operator of
pair_t must call the noexcept(false) annotate_t copy constructor.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs