commit 48ca9803695872d984b0f4efa56f7f58987d0928
Author: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed Jun 18 22:13:51 2014 +0000
PR c++/59296
* call.c (add_function_candidate): Set LOOKUP_NO_RVAL_BIND
|LOOKUP_NO_TEMP_BIND for ref-qualifier handling.
@@ -1999,6 +1999,9 @@ add_function_candidate (struct z_candidate **candidates,
object parameter has reference type. */
bool rv = FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (fn));
parmtype = cp_build_reference_type (parmtype, rv);
+ /* Don't bind an rvalue to a const lvalue ref-qualifier. */
+ if (!rv)
+ lflags |= LOOKUP_NO_RVAL_BIND|LOOKUP_NO_TEMP_BIND;
}
else
{
new file mode 100644
@@ -0,0 +1,13 @@
+// PR c++/59296
+// { dg-do compile { target c++11 } }
+
+struct Type
+{
+ void get() const& { }
+ void get() const&& { }
+};
+
+int main()
+{
+ Type{}.get();
+}