[prev in list] [next in list] [prev in thread] [next in thread]
List: llvm-bugs
Subject: [LLVMbugs] [Bug 12692] New: Confusing error message when using illegal explicitly-defaulted function
From: bugzilla-daemon () llvm ! org
Date: 2012-04-29 2:55:47
Message-ID: bug-12692-206 () http ! llvm ! org/bugs/
[Download RAW message or body]
http://llvm.org/bugs/show_bug.cgi?id=12692
Bug #: 12692
Summary: Confusing error message when using illegal
explicitly-defaulted function
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs@nondot.org
ReportedBy: martin.desharnais@gmail.com
CC: llvmbugs@cs.uiuc.edu
Classification: Unclassified
#include <utility>
struct A
{
A(int& i) : m_i(i) { }
A(const A&) = delete;
A(A&&) = default; // Illegal (C++11 12.1.5): non-static data member with no
brace-or-equal-initializer is of reference type
A& operator=(const A&) = delete;
A& operator=(A&&) = default;
int& m_i;
};
int main()
{
int i = 10;
A a1(i);
A a2(i);
a1 = std::move(a2);
}
In the above code, it we can not ask the compiler to generate a default
move-constructor since we have a non-static reference type. But the error
message is criptic.
main.cpp:22:5: error: overload resolution selected implicitly-deleted move
assignment operator
a1 = std::move(a2);
^
main.cpp:11:5: note: candidate function has been explicitly deleted
A& operator=(A&&) = default;
^
main.cpp:10:5: note: candidate function has been explicitly deleted
A& operator=(const A&) = delete;
^
1 error generated.
I see two problems with this output:
1. The error message point out that the constructor have been
implicitly-deleted. But we can wonder why since we explicitly asked the
compiler to generate a default implementation.
2. The note message said that the constructor have been explicitly deleted and
show us a call to an explicitly defaulted constructor.
I think the error message should explained that the compiler was unable to
generate the default implementation because of the reference type present in
the class.
--
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
LLVMbugs@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic