aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2009-07-31 22:26:42 -0400
committerJason Merrill <jason@gcc.gnu.org>2009-07-31 22:26:42 -0400
commite7f1930f9411e6fcee99f832a5a16c74cd6740c6 (patch)
tree835681f433a68776c98b51aa17db749656db573d /gcc
parent4c65085391c06df2a7b1acb4767e63aee6763d2c (diff)
downloadgcc-e7f1930f9411e6fcee99f832a5a16c74cd6740c6.zip
gcc-e7f1930f9411e6fcee99f832a5a16c74cd6740c6.tar.gz
gcc-e7f1930f9411e6fcee99f832a5a16c74cd6740c6.tar.bz2
call.c (convert_class_to_reference): Binding an lvalue to an rvalue reference is bad.
* call.c (convert_class_to_reference): Binding an lvalue to an rvalue reference is bad. If the user-defined conversion is bad, set bad_p before merging conversions. (maybe_handle_ref_bind): Don't push down bad_p. (reference_binding): Binding an lvalue to an rvalue reference is bad. (convert_like_real): Give a helpful error about binding lvalue to rvalue reference. (reference_related_p): No longer static. * typeck.c (build_typed_address): New. (build_static_cast_1): Add static_cast from lvalue to &&. * cp-tree.h: Adjust. * include/bits/move.h (forward): Implement as in N2835. (move): Implement as in N2831. * include/std/istream (rvalue stream operator>>): New. * include/std/ostream (rvalue stream operator<<): New. Co-Authored-By: Douglas Gregor <doug.gregor@gmail.com> From-SVN: r150327
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog16
-rw-r--r--gcc/cp/call.c33
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/typeck.c25
-rw-r--r--gcc/testsuite/ChangeLog25
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist22.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/named.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/overload.C69
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/overloadn.C708
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv-cast.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv1n.C22
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv1p.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv2n.C161
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv2p.C31
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv3n.C255
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv3p.C52
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv4n.C283
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv4p.C51
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv5n.C197
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv5p.C29
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv6n.C78
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv6p.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv7n.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv7p.C3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv8p.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/template_deduction.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/unnamed_refs.C7
27 files changed, 1803 insertions, 312 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9a9de74..a7d26a5 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,4 +1,20 @@
2009-07-31 Jason Merrill <jason@redhat.com>
+ Douglas Gregor <doug.gregor@gmail.com>
+
+ Remove implicit binding of lvalues to rvalue references (N2831)
+ * call.c (convert_class_to_reference): Binding an lvalue to an
+ rvalue reference is bad. If the user-defined conversion is bad,
+ set bad_p before merging conversions.
+ (maybe_handle_ref_bind): Don't push down bad_p.
+ (reference_binding): Binding an lvalue to an rvalue reference is bad.
+ (convert_like_real): Give a helpful error about binding lvalue
+ to rvalue reference.
+ (reference_related_p): No longer static.
+ * typeck.c (build_typed_address): New.
+ (build_static_cast_1): Add static_cast from lvalue to &&.
+ * cp-tree.h: Adjust.
+
+2009-07-31 Jason Merrill <jason@redhat.com>
* call.c (reference_binding): Rename lvalue_p to is_lvalue.
Do direct binding of "rvalues" in memory to rvalue references.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 144d07e..a667434 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -190,7 +190,6 @@ static struct z_candidate *add_candidate
conversion **, tree, tree, int);
static tree source_type (conversion *);
static void add_warning (struct z_candidate *, struct z_candidate *);
-static bool reference_related_p (tree, tree);
static bool reference_compatible_p (tree, tree);
static conversion *convert_class_to_reference (tree, tree, tree, int);
static conversion *direct_reference_binding (tree, conversion *);
@@ -966,7 +965,7 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
/* Returns nonzero if T1 is reference-related to T2. */
-static bool
+bool
reference_related_p (tree t1, tree t2)
{
t1 = TYPE_MAIN_VARIANT (t1);
@@ -1110,6 +1109,11 @@ convert_class_to_reference (tree reference_type, tree s, tree expr, int flags)
= TYPE_REF_IS_RVALUE (TREE_TYPE (TREE_TYPE (cand->fn)))
== TYPE_REF_IS_RVALUE (reference_type);
cand->second_conv->bad_p |= cand->convs[0]->bad_p;
+
+ /* Don't allow binding of lvalues to rvalue references. */
+ if (TYPE_REF_IS_RVALUE (reference_type)
+ && !TYPE_REF_IS_RVALUE (TREE_TYPE (TREE_TYPE (cand->fn))))
+ cand->second_conv->bad_p = true;
}
}
}
@@ -1137,13 +1141,13 @@ convert_class_to_reference (tree reference_type, tree s, tree expr, int flags)
build_identity_conv (TREE_TYPE (expr), expr));
conv->cand = cand;
+ if (cand->viable == -1)
+ conv->bad_p = true;
+
/* Merge it with the standard conversion sequence from the
conversion function's return type to the desired type. */
cand->second_conv = merge_conversion_sequences (conv, cand->second_conv);
- if (cand->viable == -1)
- conv->bad_p = true;
-
return cand->second_conv;
}
@@ -1308,6 +1312,11 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags)
actually occurs. */
conv->need_temporary_p = true;
+ /* Don't allow binding of lvalues to rvalue references. */
+ if (is_lvalue && TYPE_REF_IS_RVALUE (rto)
+ && !(flags & LOOKUP_PREFER_RVALUE))
+ conv->bad_p = true;
+
return conv;
}
/* [class.conv.fct] A conversion function is never used to convert a
@@ -4961,6 +4970,19 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
{
tree ref_type = totype;
+ if (convs->bad_p && TYPE_REF_IS_RVALUE (ref_type)
+ && real_lvalue_p (expr))
+ {
+ if (complain & tf_error)
+ {
+ error ("cannot bind %qT lvalue to %qT",
+ TREE_TYPE (expr), totype);
+ if (fn)
+ error (" initializing argument %P of %q+D", argnum, fn);
+ }
+ return error_mark_node;
+ }
+
/* If necessary, create a temporary.
VA_ARG_EXPR and CONSTRUCTOR expressions are special cases
@@ -6459,7 +6481,6 @@ maybe_handle_ref_bind (conversion **ics)
conversion *old_ics = *ics;
*ics = old_ics->u.next;
(*ics)->user_conv_p = old_ics->user_conv_p;
- (*ics)->bad_p = old_ics->bad_p;
return old_ics;
}
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 07e89d3..c507ac8 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4266,6 +4266,7 @@ extern tree set_up_extended_ref_temp (tree, tree, tree *, tree *);
extern tree initialize_reference (tree, tree, tree, tree *);
extern tree make_temporary_var_for_ref_to_temp (tree, tree);
extern tree strip_top_quals (tree);
+extern bool reference_related_p (tree, tree);
extern tree perform_implicit_conversion (tree, tree, tsubst_flags_t);
extern tree perform_implicit_conversion_flags (tree, tree, tsubst_flags_t, int);
extern tree perform_direct_initialization_if_possible (tree, tree, bool,
@@ -5062,6 +5063,7 @@ extern tree cp_build_binary_op (location_t,
#define cxx_sizeof(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, true)
extern tree build_ptrmemfunc_access_expr (tree, tree);
extern tree build_address (tree);
+extern tree build_typed_address (tree, tree);
extern tree build_nop (tree, tree);
extern tree non_reference (tree);
extern tree lookup_anon_field (tree, tree);
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index a956fdc..ef69f1d 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -4290,6 +4290,19 @@ build_address (tree t)
return t;
}
+/* Returns the address of T with type TYPE. */
+
+tree
+build_typed_address (tree t, tree type)
+{
+ if (error_operand_p (t) || !cxx_mark_addressable (t))
+ return error_mark_node;
+ t = build_fold_addr_expr_with_type (t, type);
+ if (TREE_CODE (t) != ADDR_EXPR)
+ t = rvalue (t);
+ return t;
+}
+
/* Return a NOP_EXPR converting EXPR to TYPE. */
tree
@@ -5313,6 +5326,18 @@ build_static_cast_1 (tree type, tree expr, bool c_cast_p,
return convert_from_reference (cp_fold_convert (type, expr));
}
+ /* "An lvalue of type cv1 T1 can be cast to type rvalue reference to
+ cv2 T2 if cv2 T2 is reference-compatible with cv1 T1 (8.5.3)." */
+ if (TREE_CODE (type) == REFERENCE_TYPE
+ && TYPE_REF_IS_RVALUE (type)
+ && real_lvalue_p (expr)
+ && reference_related_p (TREE_TYPE (type), intype)
+ && (c_cast_p || at_least_as_qualified_p (TREE_TYPE (type), intype)))
+ {
+ expr = build_typed_address (expr, type);
+ return convert_from_reference (expr);
+ }
+
orig = expr;
/* [expr.static.cast]
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2cfe47b..31ef702 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,28 @@
+2009-07-31 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/initlist22.C: Adjust for new rvalue reference
+ binding semantics.
+ * g++.dg/cpp0x/named.C: Likewise.
+ * g++.dg/cpp0x/overload.C: Likewise.
+ * g++.dg/cpp0x/rv1n.C: Likewise.
+ * g++.dg/cpp0x/rv1p.C: Likewise.
+ * g++.dg/cpp0x/rv2n.C: Likewise.
+ * g++.dg/cpp0x/rv2p.C: Likewise.
+ * g++.dg/cpp0x/rv3n.C: Likewise.
+ * g++.dg/cpp0x/rv3p.C: Likewise.
+ * g++.dg/cpp0x/rv4n.C: Likewise.
+ * g++.dg/cpp0x/rv4p.C: Likewise.
+ * g++.dg/cpp0x/rv5n.C: Likewise.
+ * g++.dg/cpp0x/rv5p.C: Likewise.
+ * g++.dg/cpp0x/rv6n.C: Likewise.
+ * g++.dg/cpp0x/rv6p.C: Likewise.
+ * g++.dg/cpp0x/rv7n.C: Likewise.
+ * g++.dg/cpp0x/rv7p.C: Likewise.
+ * g++.dg/cpp0x/template_deduction.C: Likewise.
+ * g++.dg/cpp0x/unnamed_refs.C: Likewise.
+ * g++.dg/cpp0x/overloadn.C: New.
+ * g++.dg/cpp0x/rv-cast.C: New.
+
2009-07-31 Adam Nemet <anemet@caviumnetworks.com>
* gcc.target/mips/ext-4.c: New test.
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist22.C b/gcc/testsuite/g++.dg/cpp0x/initlist22.C
index bf1c554..0855b59 100644
--- a/gcc/testsuite/g++.dg/cpp0x/initlist22.C
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist22.C
@@ -4,7 +4,7 @@
int i;
int& r1{ i }; // OK, direct binding
-int&& r2{ i }; // OK, direct binding
+int&& r2{ i }; // { dg-error "" } binding && to lvalue
int& r3{ }; // { dg-error "" } reference to temporary
int&& r4{ }; // OK, reference to temporary
diff --git a/gcc/testsuite/g++.dg/cpp0x/named.C b/gcc/testsuite/g++.dg/cpp0x/named.C
index b91e698..ef1a2fb 100644
--- a/gcc/testsuite/g++.dg/cpp0x/named.C
+++ b/gcc/testsuite/g++.dg/cpp0x/named.C
@@ -1,12 +1,17 @@
// { dg-options "--std=c++0x" }
// { dg-do link }
+template<typename _Tp>
+inline _Tp&&
+movel(_Tp& __t)
+{ return static_cast<_Tp&&>(__t); }
+
struct S {};
struct T
{
- T(S && s_) : s(s_) {}
- S && get() { return s; }
- operator S&&() { return s; }
+ T(S && s_) : s(movel(s_)) {}
+ S && get() { return movel(s); }
+ operator S&&() { return movel(s); }
S && s;
};
@@ -18,8 +23,8 @@ void unnamed(S&&) {}
void f(S && p)
{
- S && s(p);
- T t(s);
+ S && s(movel(p));
+ T t(movel(s));
named(s); // variable reference
named(p); // parameter reference
diff --git a/gcc/testsuite/g++.dg/cpp0x/overload.C b/gcc/testsuite/g++.dg/cpp0x/overload.C
index 945860c..3782d4a 100644
--- a/gcc/testsuite/g++.dg/cpp0x/overload.C
+++ b/gcc/testsuite/g++.dg/cpp0x/overload.C
@@ -2,6 +2,11 @@
// { dg-do link }
// Generated by overload.py
+template<typename _Tp>
+inline _Tp&&
+movel(_Tp& __t)
+{ return static_cast<_Tp&&>(__t); }
+
struct S{};
S l; // lvalue (l)
@@ -10,12 +15,12 @@ S r() { return l; } // rvalue (r)
S const cr() { return l; } // const rvalue (cr)
S & nl = l; // named lvalue reference (nl)
S const & ncl = l; // named const lvalue reference (ncl)
-S && nr = l; // named rvalue reference (nr)
-S const && ncr = l; // named const rvalue reference (ncr)
+S && nr = movel(l); // named rvalue reference (nr)
+S const && ncr = movel(l); // named const rvalue reference (ncr)
S & ul() { return l; } // unnamed lvalue reference (ul)
S const & ucl() { return l; } // unnamed const lvalue reference (ucl)
-S && ur() { return l; } // unnamed rvalue reference (ur)
-S const && ucr() { return l; } // unnamed const rvalue reference (ucr)
+S && ur() { return movel(l); } // unnamed rvalue reference (ur)
+S const && ucr() { return movel(l); } // unnamed const rvalue reference (ucr)
void l0001(const S&&) {}
@@ -538,9 +543,9 @@ void ucr1111(const S&&) {}
int main()
{
- l0001(l);
- l0010(l);
- l0011(l);
+ //l0001(l);
+ //l0010(l);
+ //l0011(l);
l0100(l);
l0101(l);
l0110(l);
@@ -553,14 +558,14 @@ int main()
l1101(l);
l1110(l);
l1111(l);
- cl0001(cl);
- cl0011(cl);
+ //cl0001(cl);
+ //cl0011(cl);
cl0100(cl);
cl0101(cl);
cl0110(cl);
cl0111(cl);
- cl1001(cl);
- cl1011(cl);
+ //cl1001(cl);
+ //cl1011(cl);
cl1100(cl);
cl1101(cl);
cl1110(cl);
@@ -591,9 +596,9 @@ int main()
cr1101(cr());
cr1110(cr());
cr1111(cr());
- nl0001(nl);
- nl0010(nl);
- nl0011(nl);
+ //nl0001(nl);
+ //nl0010(nl);
+ //nl0011(nl);
nl0100(nl);
nl0101(nl);
nl0110(nl);
@@ -606,21 +611,21 @@ int main()
nl1101(nl);
nl1110(nl);
nl1111(nl);
- ncl0001(ncl);
- ncl0011(ncl);
+ //ncl0001(ncl);
+ //ncl0011(ncl);
ncl0100(ncl);
ncl0101(ncl);
ncl0110(ncl);
ncl0111(ncl);
- ncl1001(ncl);
- ncl1011(ncl);
+ //ncl1001(ncl);
+ //ncl1011(ncl);
ncl1100(ncl);
ncl1101(ncl);
ncl1110(ncl);
ncl1111(ncl);
- nr0001(nr);
- nr0010(nr);
- nr0011(nr);
+ //nr0001(nr);
+ //nr0010(nr);
+ //nr0011(nr);
nr0100(nr);
nr0101(nr);
nr0110(nr);
@@ -633,21 +638,21 @@ int main()
nr1101(nr);
nr1110(nr);
nr1111(nr);
- ncr0001(ncr);
- ncr0011(ncr);
+ //ncr0001(ncr);
+ //ncr0011(ncr);
ncr0100(ncr);
ncr0101(ncr);
ncr0110(ncr);
ncr0111(ncr);
- ncr1001(ncr);
- ncr1011(ncr);
+ //ncr1001(ncr);
+ //ncr1011(ncr);
ncr1100(ncr);
ncr1101(ncr);
ncr1110(ncr);
ncr1111(ncr);
- ul0001(ul());
- ul0010(ul());
- ul0011(ul());
+ //ul0001(ul());
+ //ul0010(ul());
+ //ul0011(ul());
ul0100(ul());
ul0101(ul());
ul0110(ul());
@@ -660,14 +665,14 @@ int main()
ul1101(ul());
ul1110(ul());
ul1111(ul());
- ucl0001(ucl());
- ucl0011(ucl());
+ //ucl0001(ucl());
+ //ucl0011(ucl());
ucl0100(ucl());
ucl0101(ucl());
ucl0110(ucl());
ucl0111(ucl());
- ucl1001(ucl());
- ucl1011(ucl());
+ //ucl1001(ucl());
+ //ucl1011(ucl());
ucl1100(ucl());
ucl1101(ucl());
ucl1110(ucl());
diff --git a/gcc/testsuite/g++.dg/cpp0x/overloadn.C b/gcc/testsuite/g++.dg/cpp0x/overloadn.C
new file mode 100644
index 0000000..a42707f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/overloadn.C
@@ -0,0 +1,708 @@
+// { dg-options "--std=c++0x" }
+// { dg-do link }
+// Generated by overload.py
+
+template<typename _Tp>
+inline _Tp&&
+movel(_Tp& __t)
+{ return static_cast<_Tp&&>(__t); }
+
+struct S{};
+
+S l; // lvalue (l)
+S const cl = l; // const lvalue (cl)
+S r() { return l; } // rvalue (r)
+S const cr() { return l; } // const rvalue (cr)
+S & nl = l; // named lvalue reference (nl)
+S const & ncl = l; // named const lvalue reference (ncl)
+S && nr = movel(l); // named rvalue reference (nr)
+S const && ncr = movel(l); // named const rvalue reference (ncr)
+S & ul() { return l; } // unnamed lvalue reference (ul)
+S const & ucl() { return l; } // unnamed const lvalue reference (ucl)
+S && ur() { return movel(l); } // unnamed rvalue reference (ur)
+S const && ucr() { return movel(l); } // unnamed const rvalue reference (ucr)
+
+void l0001(const S&&) {} // { dg-message "" }
+
+void l0010(S&&) {} // { dg-message "" }
+
+void l0011(S&&) {} // { dg-message "" }
+void l0011(const S&&);
+
+void l0100(const S&) {}
+
+void l0101(const S&) {}
+void l0101(const S&&);
+
+void l0110(const S&) {}
+void l0110(S&&);
+
+void l0111(const S&) {}
+void l0111(S&&);
+void l0111(const S&&);
+
+void l1000(S&) {}
+
+void l1001(S&) {}
+void l1001(const S&&);
+
+void l1010(S&) {}
+void l1010(S&&);
+
+void l1011(S&) {}
+void l1011(S&&);
+void l1011(const S&&);
+
+void l1100(S&) {}
+void l1100(const S&);
+
+void l1101(S&) {}
+void l1101(const S&);
+void l1101(const S&&);
+
+void l1110(S&) {}
+void l1110(const S&);
+void l1110(S&&);
+
+void l1111(S&) {}
+void l1111(const S&);
+void l1111(S&&);
+void l1111(const S&&);
+
+void cl0001(const S&&) {} // { dg-message "" }
+
+void cl0011(S&&);
+void cl0011(const S&&) {} // { dg-message "" }
+
+void cl0100(const S&) {}
+
+void cl0101(const S&) {}
+void cl0101(const S&&);
+
+void cl0110(const S&) {}
+void cl0110(S&&);
+
+void cl0111(const S&) {}
+void cl0111(S&&);
+void cl0111(const S&&);
+
+void cl1001(S&);
+void cl1001(const S&&) {} // { dg-message "" }
+
+void cl1011(S&);
+void cl1011(S&&);
+void cl1011(const S&&) {} // { dg-message "" }
+
+void cl1100(S&);
+void cl1100(const S&) {}
+
+void cl1101(S&);
+void cl1101(const S&) {}
+void cl1101(const S&&);
+
+void cl1110(S&);
+void cl1110(const S&) {}
+void cl1110(S&&);
+
+void cl1111(S&);
+void cl1111(const S&) {}
+void cl1111(S&&);
+void cl1111(const S&&);
+
+void r0001(const S&&) {}
+
+void r0010(S&&) {}
+
+void r0011(S&&) {}
+void r0011(const S&&);
+
+void r0100(const S&) {}
+
+void r0101(const S&);
+void r0101(const S&&) {}
+
+void r0110(const S&);
+void r0110(S&&) {}
+
+void r0111(const S&);
+void r0111(S&&) {}
+void r0111(const S&&);
+
+void r1001(S&);
+void r1001(const S&&) {}
+
+void r1010(S&);
+void r1010(S&&) {}
+
+void r1011(S&);
+void r1011(S&&) {}
+void r1011(const S&&);
+
+void r1100(S&);
+void r1100(const S&) {}
+
+void r1101(S&);
+void r1101(const S&);
+void r1101(const S&&) {}
+
+void r1110(S&);
+void r1110(const S&);
+void r1110(S&&) {}
+
+void r1111(S&);
+void r1111(const S&);
+void r1111(S&&) {}
+void r1111(const S&&);
+
+void cr0001(const S&&) {}
+
+void cr0011(S&&);
+void cr0011(const S&&) {}
+
+void cr0100(const S&) {}
+
+void cr0101(const S&);
+void cr0101(const S&&) {}
+
+void cr0110(const S&) {}
+void cr0110(S&&);
+
+void cr0111(const S&);
+void cr0111(S&&);
+void cr0111(const S&&) {}
+
+void cr1001(S&);
+void cr1001(const S&&) {}
+
+void cr1011(S&);
+void cr1011(S&&);
+void cr1011(const S&&) {}
+
+void cr1100(S&);
+void cr1100(const S&) {}
+
+void cr1101(S&);
+void cr1101(const S&);
+void cr1101(const S&&) {}
+
+void cr1110(S&);
+void cr1110(const S&) {}
+void cr1110(S&&);
+
+void cr1111(S&);
+void cr1111(const S&);
+void cr1111(S&&);
+void cr1111(const S&&) {}
+
+void nl0001(const S&&) {} // { dg-message "" }
+
+void nl0010(S&&) {} // { dg-message "" }
+
+void nl0011(S&&) {} // { dg-message "" }
+void nl0011(const S&&);
+
+void nl0100(const S&) {}
+
+void nl0101(const S&) {}
+void nl0101(const S&&);
+
+void nl0110(const S&) {}
+void nl0110(S&&);
+
+void nl0111(const S&) {}
+void nl0111(S&&);
+void nl0111(const S&&);
+
+void nl1000(S&) {}
+
+void nl1001(S&) {}
+void nl1001(const S&&);
+
+void nl1010(S&) {}
+void nl1010(S&&);
+
+void nl1011(S&) {}
+void nl1011(S&&);
+void nl1011(const S&&);
+
+void nl1100(S&) {}
+void nl1100(const S&);
+
+void nl1101(S&) {}
+void nl1101(const S&);
+void nl1101(const S&&);
+
+void nl1110(S&) {}
+void nl1110(const S&);
+void nl1110(S&&);
+
+void nl1111(S&) {}
+void nl1111(const S&);
+void nl1111(S&&);
+void nl1111(const S&&);
+
+void ncl0001(const S&&) {} // { dg-message "" }
+
+void ncl0011(S&&);
+void ncl0011(const S&&) {} // { dg-message "" }
+
+void ncl0100(const S&) {}
+
+void ncl0101(const S&) {}
+void ncl0101(const S&&);
+
+void ncl0110(const S&) {}
+void ncl0110(S&&);
+
+void ncl0111(const S&) {}
+void ncl0111(S&&);
+void ncl0111(const S&&);
+
+void ncl1001(S&);
+void ncl1001(const S&&) {} // { dg-message "" }
+
+void ncl1011(S&);
+void ncl1011(S&&);
+void ncl1011(const S&&) {} // { dg-message "" }
+
+void ncl1100(S&);
+void ncl1100(const S&) {}
+
+void ncl1101(S&);
+void ncl1101(const S&) {}
+void ncl1101(const S&&);
+
+void ncl1110(S&);
+void ncl1110(const S&) {}
+void ncl1110(S&&);
+
+void ncl1111(S&);
+void ncl1111(const S&) {}
+void ncl1111(S&&);
+void ncl1111(const S&&);
+
+void nr0001(const S&&) {} // { dg-message "" }
+
+void nr0010(S&&) {} // { dg-message "" }
+
+void nr0011(S&&) {} // { dg-message "" }
+void nr0011(const S&&);
+
+void nr0100(const S&) {}
+
+void nr0101(const S&) {}
+void nr0101(const S&&);
+
+void nr0110(const S&) {}
+void nr0110(S&&);
+
+void nr0111(const S&) {}
+void nr0111(S&&);
+void nr0111(const S&&);
+
+void nr1000(S&) {}
+
+void nr1001(S&) {}
+void nr1001(const S&&);
+
+void nr1010(S&) {}
+void nr1010(S&&);
+
+void nr1011(S&) {}
+void nr1011(S&&);
+void nr1011(const S&&);
+
+void nr1100(S&) {}
+void nr1100(const S&);
+
+void nr1101(S&) {}
+void nr1101(const S&);
+void nr1101(const S&&);
+
+void nr1110(S&) {}
+void nr1110(const S&);
+void nr1110(S&&);
+
+void nr1111(S&) {}
+void nr1111(const S&);
+void nr1111(S&&);
+void nr1111(const S&&);
+
+void ncr0001(const S&&) {} // { dg-message "" }
+
+void ncr0011(S&&);
+void ncr0011(const S&&) {} // { dg-message "" }
+
+void ncr0100(const S&) {}
+
+void ncr0101(const S&) {}
+void ncr0101(const S&&);
+
+void ncr0110(const S&) {}
+void ncr0110(S&&);
+
+void ncr0111(const S&) {}
+void ncr0111(S&&);
+void ncr0111(const S&&);
+
+void ncr1001(S&);
+void ncr1001(const S&&) {} // { dg-message "" }
+
+void ncr1011(S&);
+void ncr1011(S&&);
+void ncr1011(const S&&) {} // { dg-message "" }
+
+void ncr1100(S&);
+void ncr1100(const S&) {}
+
+void ncr1101(S&);
+void ncr1101(const S&) {}
+void ncr1101(const S&&);
+
+void ncr1110(S&);
+void ncr1110(const S&) {}
+void ncr1110(S&&);
+
+void ncr1111(S&);
+void ncr1111(const S&) {}
+void ncr1111(S&&);
+void ncr1111(const S&&);
+
+void ul0001(const S&&) {} // { dg-message "" }
+
+void ul0010(S&&) {} // { dg-message "" }
+
+void ul0011(S&&) {} // { dg-message "" }
+void ul0011(const S&&);
+
+void ul0100(const S&) {}
+
+void ul0101(const S&) {}
+void ul0101(const S&&);
+
+void ul0110(const S&) {}
+void ul0110(S&&);
+
+void ul0111(const S&) {}
+void ul0111(S&&);
+void ul0111(const S&&);
+
+void ul1000(S&) {}
+
+void ul1001(S&) {}
+void ul1001(const S&&);
+
+void ul1010(S&) {}
+void ul1010(S&&);
+
+void ul1011(S&) {}
+void ul1011(S&&);
+void ul1011(const S&&);
+
+void ul1100(S&) {}
+void ul1100(const S&);
+
+void ul1101(S&) {}
+void ul1101(const S&);
+void ul1101(const S&&);
+
+void ul1110(S&) {}
+void ul1110(const S&);
+void ul1110(S&&);
+
+void ul1111(S&) {}
+void ul1111(const S&);
+void ul1111(S&&);
+void ul1111(const S&&);
+
+void ucl0001(const S&&) {} // { dg-message "" }
+
+void ucl0011(S&&);
+void ucl0011(const S&&) {} // { dg-message "" }
+
+void ucl0100(const S&) {}
+
+void ucl0101(const S&) {}
+void ucl0101(const S&&);
+
+void ucl0110(const S&) {}
+void ucl0110(S&&);
+
+void ucl0111(const S&) {}
+void ucl0111(S&&);
+void ucl0111(const S&&);
+
+void ucl1001(S&);
+void ucl1001(const S&&) {} // { dg-message "" }
+
+void ucl1011(S&);
+void ucl1011(S&&);
+void ucl1011(const S&&) {} // { dg-message "" }
+
+void ucl1100(S&);
+void ucl1100(const S&) {}
+
+void ucl1101(S&);
+void ucl1101(const S&) {}
+void ucl1101(const S&&);
+
+void ucl1110(S&);
+void ucl1110(const S&) {}
+void ucl1110(S&&);
+
+void ucl1111(S&);
+void ucl1111(const S&) {}
+void ucl1111(S&&);
+void ucl1111(const S&&);
+
+void ur0001(const S&&) {}
+
+void ur0010(S&&) {}
+
+void ur0011(S&&) {}
+void ur0011(const S&&);
+
+void ur0100(const S&) {}
+
+void ur0101(const S&);
+void ur0101(const S&&) {}
+
+void ur0110(const S&);
+void ur0110(S&&) {}
+
+void ur0111(const S&);
+void ur0111(S&&) {}
+void ur0111(const S&&);
+
+void ur1001(S&);
+void ur1001(const S&&) {}
+
+void ur1010(S&);
+void ur1010(S&&) {}
+
+void ur1011(S&);
+void ur1011(S&&) {}
+void ur1011(const S&&);
+
+void ur1100(S&);
+void ur1100(const S&) {}
+
+void ur1101(S&);
+void ur1101(const S&);
+void ur1101(const S&&) {}
+
+void ur1110(S&);
+void ur1110(const S&);
+void ur1110(S&&) {}
+
+void ur1111(S&);
+void ur1111(const S&);
+void ur1111(S&&) {}
+void ur1111(const S&&);
+
+void ucr0001(const S&&) {}
+
+void ucr0011(S&&);
+void ucr0011(const S&&) {}
+
+void ucr0100(const S&) {}
+
+void ucr0101(const S&);
+void ucr0101(const S&&) {}
+
+void ucr0110(const S&) {}
+void ucr0110(S&&);
+
+void ucr0111(const S&);
+void ucr0111(S&&);
+void ucr0111(const S&&) {}
+
+void ucr1001(S&);
+void ucr1001(const S&&) {}
+
+void ucr1011(S&);
+void ucr1011(S&&);
+void ucr1011(const S&&) {}
+
+void ucr1100(S&);
+void ucr1100(const S&) {}
+
+void ucr1101(S&);
+void ucr1101(const S&);
+void ucr1101(const S&&) {}
+
+void ucr1110(S&);
+void ucr1110(const S&) {}
+void ucr1110(S&&);
+
+void ucr1111(S&);
+void ucr1111(const S&);
+void ucr1111(S&&);
+void ucr1111(const S&&) {}
+
+
+int main()
+{
+ l0001(l); // { dg-error "lvalue" }
+ l0010(l); // { dg-error "lvalue" }
+ l0011(l); // { dg-error "lvalue" }
+ l0100(l);
+ l0101(l);
+ l0110(l);
+ l0111(l);
+ l1000(l);
+ l1001(l);
+ l1010(l);
+ l1011(l);
+ l1100(l);
+ l1101(l);
+ l1110(l);
+ l1111(l);
+ cl0001(cl); // { dg-error "lvalue" }
+ cl0011(cl); // { dg-error "lvalue" }
+ cl0100(cl);
+ cl0101(cl);
+ cl0110(cl);
+ cl0111(cl);
+ cl1001(cl); // { dg-error "lvalue" }
+ cl1011(cl); // { dg-error "lvalue" }
+ cl1100(cl);
+ cl1101(cl);
+ cl1110(cl);
+ cl1111(cl);
+ r0001(r());
+ r0010(r());
+ r0011(r());
+ r0100(r());
+ r0101(r());
+ r0110(r());
+ r0111(r());
+ r1001(r());
+ r1010(r());
+ r1011(r());
+ r1100(r());
+ r1101(r());
+ r1110(r());
+ r1111(r());
+ cr0001(cr());
+ cr0011(cr());
+ cr0100(cr());
+ cr0101(cr());
+ cr0110(cr());
+ cr0111(cr());
+ cr1001(cr());
+ cr1011(cr());
+ cr1100(cr());
+ cr1101(cr());
+ cr1110(cr());
+ cr1111(cr());
+ nl0001(nl); // { dg-error "lvalue" }
+ nl0010(nl); // { dg-error "lvalue" }
+ nl0011(nl); // { dg-error "lvalue" }
+ nl0100(nl);
+ nl0101(nl);
+ nl0110(nl);
+ nl0111(nl);
+ nl1000(nl);
+ nl1001(nl);
+ nl1010(nl);
+ nl1011(nl);
+ nl1100(nl);
+ nl1101(nl);
+ nl1110(nl);
+ nl1111(nl);
+ ncl0001(ncl); // { dg-error "lvalue" }
+ ncl0011(ncl); // { dg-error "lvalue" }
+ ncl0100(ncl);
+ ncl0101(ncl);
+ ncl0110(ncl);
+ ncl0111(ncl);
+ ncl1001(ncl); // { dg-error "lvalue" }
+ ncl1011(ncl); // { dg-error "lvalue" }
+ ncl1100(ncl);
+ ncl1101(ncl);
+ ncl1110(ncl);
+ ncl1111(ncl);
+ nr0001(nr); // { dg-error "lvalue" }
+ nr0010(nr); // { dg-error "lvalue" }
+ nr0011(nr); // { dg-error "lvalue" }
+ nr0100(nr);
+ nr0101(nr);
+ nr0110(nr);
+ nr0111(nr);
+ nr1000(nr);
+ nr1001(nr);
+ nr1010(nr);
+ nr1011(nr);
+ nr1100(nr);
+ nr1101(nr);
+ nr1110(nr);
+ nr1111(nr);
+ ncr0001(ncr); // { dg-error "lvalue" }
+ ncr0011(ncr); // { dg-error "lvalue" }
+ ncr0100(ncr);
+ ncr0101(ncr);
+ ncr0110(ncr);
+ ncr0111(ncr);
+ ncr1001(ncr); // { dg-error "lvalue" }
+ ncr1011(ncr); // { dg-error "lvalue" }
+ ncr1100(ncr);
+ ncr1101(ncr);
+ ncr1110(ncr);
+ ncr1111(ncr);
+ ul0001(ul()); // { dg-error "lvalue" }
+ ul0010(ul()); // { dg-error "lvalue" }
+ ul0011(ul()); // { dg-error "lvalue" }
+ ul0100(ul());
+ ul0101(ul());
+ ul0110(ul());
+ ul0111(ul());
+ ul1000(ul());
+ ul1001(ul());
+ ul1010(ul());
+ ul1011(ul());
+ ul1100(ul());
+ ul1101(ul());
+ ul1110(ul());
+ ul1111(ul());
+ ucl0001(ucl()); // { dg-error "lvalue" }
+ ucl0011(ucl()); // { dg-error "lvalue" }
+ ucl0100(ucl());
+ ucl0101(ucl());
+ ucl0110(ucl());
+ ucl0111(ucl());
+ ucl1001(ucl()); // { dg-error "lvalue" }
+ ucl1011(ucl()); // { dg-error "lvalue" }
+ ucl1100(ucl());
+ ucl1101(ucl());
+ ucl1110(ucl());
+ ucl1111(ucl());
+ ur0001(ur());
+ ur0010(ur());
+ ur0011(ur());
+ ur0100(ur());
+ ur0101(ur());
+ ur0110(ur());
+ ur0111(ur());
+ ur1001(ur());
+ ur1010(ur());
+ ur1011(ur());
+ ur1100(ur());
+ ur1101(ur());
+ ur1110(ur());
+ ur1111(ur());
+ ucr0001(ucr());
+ ucr0011(ucr());
+ ucr0100(ucr());
+ ucr0101(ucr());
+ ucr0110(ucr());
+ ucr0111(ucr());
+ ucr1001(ucr());
+ ucr1011(ucr());
+ ucr1100(ucr());
+ ucr1101(ucr());
+ ucr1110(ucr());
+ ucr1111(ucr());
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv-cast.C b/gcc/testsuite/g++.dg/cpp0x/rv-cast.C
new file mode 100644
index 0000000..48b7c13
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/rv-cast.C
@@ -0,0 +1,6 @@
+// { dg-options "-std=c++0x" }
+
+void f(int i)
+{
+ int&& r = static_cast<int&&>(i);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv1n.C b/gcc/testsuite/g++.dg/cpp0x/rv1n.C
index 10b5dc2..b7b9b6e 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv1n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv1n.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -103,6 +103,7 @@ int test1_5()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_1_5(a); // { dg-error "lvalue" }
sink_1_5(ca); // { dg-error "invalid initialization" }
sink_1_5(va); // { dg-error "invalid initialization" }
sink_1_5(cva); // { dg-error "invalid initialization" }
@@ -120,6 +121,8 @@ int test1_6()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_1_6(a); // { dg-error "lvalue" }
+ sink_1_6(ca); // { dg-error "lvalue" }
sink_1_6(va); // { dg-error "invalid initialization" }
sink_1_6(cva); // { dg-error "invalid initialization" }
sink_1_6(v_source()); // { dg-error "invalid initialization" }
@@ -135,13 +138,30 @@ int test1_7()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_1_7(a); // { dg-error "lvalue" }
sink_1_7(ca); // { dg-error "invalid initialization" }
+ sink_1_7(va); // { dg-error "lvalue" }
sink_1_7(cva); // { dg-error "invalid initialization" }
sink_1_7(c_source()); // { dg-error "invalid initialization" }
sink_1_7(cv_source()); // { dg-error "invalid initialization" }
return 0;
}
+eight sink_1_8(const volatile A&&); // { dg-error "" }
+
+int test1_8()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_1_8(a); // { dg-error "lvalue" }
+ sink_1_8(ca); // { dg-error "lvalue" }
+ sink_1_8(va); // { dg-error "lvalue" }
+ sink_1_8(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
int main()
{
return test1_1() + test1_2() + test1_3() + test1_5() +
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv1p.C b/gcc/testsuite/g++.dg/cpp0x/rv1p.C
index 6241885..b2770ef 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv1p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv1p.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -93,7 +93,6 @@ int test1_5()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_1_5(a)) == 5> t1;
sa<sizeof(sink_1_5(source())) == 5> t5;
return 0;
}
@@ -106,8 +105,6 @@ int test1_6()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_1_6(a)) == 6> t1;
- sa<sizeof(sink_1_6(ca)) == 6> t2;
sa<sizeof(sink_1_6(source())) == 6> t5;
sa<sizeof(sink_1_6(c_source())) == 6> t6;
return 0;
@@ -121,8 +118,6 @@ int test1_7()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_1_7(a)) == 7> t1;
- sa<sizeof(sink_1_7(va)) == 7> t3;
sa<sizeof(sink_1_7(source())) == 7> t5;
sa<sizeof(sink_1_7(v_source())) == 7> t7;
return 0;
@@ -136,10 +131,6 @@ int test1_8()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_1_8(a)) == 8> t1;
- sa<sizeof(sink_1_8(ca)) == 8> t2;
- sa<sizeof(sink_1_8(va)) == 8> t3;
- sa<sizeof(sink_1_8(cva)) == 8> t4;
sa<sizeof(sink_1_8(source())) == 8> t5;
sa<sizeof(sink_1_8(c_source())) == 8> t6;
sa<sizeof(sink_1_8(v_source())) == 8> t7;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv2n.C b/gcc/testsuite/g++.dg/cpp0x/rv2n.C
index a4c11c6..5eee82c 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv2n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv2n.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -30,8 +30,8 @@ const volatile A cv_source();
// 2 at a time
-one sink_2_12( A&); // { dg-message "candidates" }
-two sink_2_12(const A&); // { dg-message "note" }
+one sink_2_12( A&); // { dg-message "candidates|argument" }
+two sink_2_12(const A&); // { dg-message "note|argument" }
int test2_12()
{
@@ -46,8 +46,8 @@ int test2_12()
return 0;
}
-one sink_2_13( A&); // { dg-message "candidates" }
-three sink_2_13(volatile A&); // { dg-message "note" }
+one sink_2_13( A&); // { dg-message "candidates|argument" }
+three sink_2_13(volatile A&); // { dg-message "note|argument" }
int test2_13()
{
@@ -64,8 +64,8 @@ int test2_13()
return 0;
}
-one sink_2_14( A&); // { dg-message "candidates" }
-four sink_2_14(const volatile A&); // { dg-message "note" }
+one sink_2_14( A&); // { dg-message "candidates|argument" }
+four sink_2_14(const volatile A&); // { dg-message "note|argument" }
int test2_14()
{
@@ -80,8 +80,8 @@ int test2_14()
return 0;
}
-one sink_2_15( A&); // { dg-message "candidates" }
-five sink_2_15( A&&); // { dg-message "note" }
+one sink_2_15( A&); // { dg-message "candidates|argument" }
+five sink_2_15( A&&); // { dg-message "note|argument" }
int test2_15()
{
@@ -98,8 +98,8 @@ int test2_15()
return 0;
}
-one sink_2_16( A&); // { dg-message "candidates" }
-six sink_2_16(const A&&); // { dg-message "note" }
+one sink_2_16( A&); // { dg-message "candidates|argument" }
+six sink_2_16(const A&&); // { dg-message "note|argument" }
int test2_16()
{
@@ -107,6 +107,7 @@ int test2_16()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_2_16(ca); // { dg-error "lvalue" }
sink_2_16(va); // { dg-error "no match" }
sink_2_16(cva); // { dg-error "no match" }
sink_2_16(v_source()); // { dg-error "no match" }
@@ -114,8 +115,8 @@ int test2_16()
return 0;
}
-one sink_2_17( A&); // { dg-message "candidates" }
-seven sink_2_17(volatile A&&); // { dg-message "note" }
+one sink_2_17( A&); // { dg-message "candidates|argument" }
+seven sink_2_17(volatile A&&); // { dg-message "note|argument" }
int test2_17()
{
@@ -124,14 +125,29 @@ int test2_17()
volatile A va;
const volatile A cva = a;
sink_2_17(ca); // { dg-error "no match" }
+ sink_2_17(va); // { dg-error "lvalue" }
sink_2_17(cva); // { dg-error "no match" }
sink_2_17(c_source()); // { dg-error "no match" }
sink_2_17(cv_source()); // { dg-error "no match" }
return 0;
}
-two sink_2_23(const A&); // { dg-message "candidates" }
-three sink_2_23(volatile A&); // { dg-message "note" }
+one sink_2_18( A&);
+eight sink_2_18(const volatile A&&); // { dg-error "argument" }
+
+int test2_18()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_2_18(ca); // { dg-error "lvalue" }
+ sink_2_18(va); // { dg-error "lvalue" }
+ sink_2_18(cva); // { dg-error "lvalue" }
+}
+
+two sink_2_23(const A&); // { dg-message "candidates|argument" }
+three sink_2_23(volatile A&); // { dg-message "note|argument" }
int test2_23()
{
@@ -146,8 +162,8 @@ int test2_23()
return 0;
}
-two sink_2_24(const A&); // { dg-message "candidates" }
-four sink_2_24(const volatile A&); // { dg-message "note" }
+two sink_2_24(const A&); // { dg-message "candidates|argument" }
+four sink_2_24(const volatile A&); // { dg-message "note|argument" }
int test2_24()
{
@@ -161,7 +177,7 @@ int test2_24()
}
three sink_2_34(volatile A&); // { dg-message "candidate" }
-four sink_2_34(const volatile A&); // { dg-message "note" }
+four sink_2_34(const volatile A&); // { dg-message "note|argument" }
int test2_34()
{
@@ -177,7 +193,7 @@ int test2_34()
}
two sink_2_25(const A&); // { dg-message "candidate" }
-five sink_2_25( A&&); // { dg-message "note" }
+five sink_2_25( A&&); // { dg-message "note|argument" }
int test2_25()
{
@@ -193,7 +209,7 @@ int test2_25()
}
two sink_2_26(const A&); // { dg-message "candidate" }
-six sink_2_26(const A&&); // { dg-message "note" }
+six sink_2_26(const A&&); // { dg-message "note|argument" }
int test2_26()
{
@@ -209,7 +225,7 @@ int test2_26()
}
two sink_2_27(const A&); // { dg-message "candidate" }
-seven sink_2_27(volatile A&&); // { dg-message "note" }
+seven sink_2_27(volatile A&&); // { dg-message "note|argument" }
int test2_27()
{
@@ -217,13 +233,27 @@ int test2_27()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_2_27(va); // { dg-error "lvalue" }
sink_2_27(cva); // { dg-error "no match" }
sink_2_27(cv_source()); // { dg-error "no match" }
return 0;
}
+two sink_2_28(const A&);
+eight sink_2_28(const volatile A&&); // { dg-error "argument" }
+
+int test2_28()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_2_28(va); // { dg-error "lvalue" }
+ sink_2_28(cva); // { dg-error "lvalue" }
+}
+
three sink_2_35(volatile A&); // { dg-message "candidate" }
-five sink_2_35( A&&); // { dg-message "note" }
+five sink_2_35( A&&); // { dg-message "note|argument" }
int test2_35()
{
@@ -240,7 +270,7 @@ int test2_35()
}
three sink_2_36(volatile A&); // { dg-message "candidate" }
-six sink_2_36(const A&&); // { dg-message "note" }
+six sink_2_36(const A&&); // { dg-message "note|argument" }
int test2_36()
{
@@ -248,6 +278,7 @@ int test2_36()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_2_36(ca); // { dg-error "lvalue" }
sink_2_36(cva); // { dg-error "no match" }
sink_2_36(v_source()); // { dg-error "no match" }
sink_2_36(cv_source()); // { dg-error "no match" }
@@ -255,7 +286,7 @@ int test2_36()
}
three sink_2_37(volatile A&); // { dg-message "candidate" }
-seven sink_2_37(volatile A&&); // { dg-message "note" }
+seven sink_2_37(volatile A&&); // { dg-message "note|argument" }
int test2_37()
{
@@ -270,8 +301,21 @@ int test2_37()
return 0;
}
+three sink_2_38(volatile A&);
+eight sink_2_38(const volatile A&&); // { dg-error "argument" }
+
+int test2_38()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_2_38(ca); // { dg-error "lvalue" }
+ sink_2_38(cva); // { dg-error "lvalue" }
+}
+
four sink_2_45(const volatile A&); // { dg-message "candidate" }
-five sink_2_45( A&&); // { dg-message "note" }
+five sink_2_45( A&&); // { dg-message "note|argument" }
int test2_45()
{
@@ -286,7 +330,7 @@ int test2_45()
}
four sink_2_46(const volatile A&); // { dg-message "candidate" }
-six sink_2_46(const A&&); // { dg-message "note" }
+six sink_2_46(const A&&); // { dg-message "note|argument" }
int test2_46()
{
@@ -300,7 +344,7 @@ int test2_46()
}
four sink_2_47(const volatile A&); // { dg-message "candidate" }
-seven sink_2_47(volatile A&&); // { dg-message "note" }
+seven sink_2_47(volatile A&&); // { dg-message "note|argument" }
int test2_47()
{
@@ -313,8 +357,8 @@ int test2_47()
return 0;
}
-five sink_2_56( A&&); // { dg-message "candidate" }
-six sink_2_56(const A&&); // { dg-message "note" }
+five sink_2_56( A&&); // { dg-message "candidate|argument" }
+six sink_2_56(const A&&); // { dg-message "note|argument" }
int test2_56()
{
@@ -322,6 +366,8 @@ int test2_56()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_2_56(a); // { dg-error "lvalue" }
+ sink_2_56(ca); // { dg-error "lvalue" }
sink_2_56(va); // { dg-error "no match" }
sink_2_56(cva); // { dg-error "no match" }
sink_2_56(v_source()); // { dg-error "no match" }
@@ -329,8 +375,8 @@ int test2_56()
return 0;
}
-five sink_2_57( A&&); // { dg-message "candidate" }
-seven sink_2_57(volatile A&&); // { dg-message "note" }
+five sink_2_57( A&&); // { dg-message "candidate|argument" }
+seven sink_2_57(volatile A&&); // { dg-message "note|argument" }
int test2_57()
{
@@ -338,6 +384,8 @@ int test2_57()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_2_57(a); // { dg-error "lvalue" }
+ sink_2_57(va); // { dg-error "lvalue" }
sink_2_57(ca); // { dg-error "no match" }
sink_2_57(cva); // { dg-error "no match" }
sink_2_57(c_source()); // { dg-error "no match" }
@@ -345,8 +393,23 @@ int test2_57()
return 0;
}
-six sink_2_67(const A&&); // { dg-message "candidate" }
-seven sink_2_67(volatile A&&); // { dg-message "note" }
+five sink_2_58( A&&); // { dg-error "argument" }
+eight sink_2_58(const volatile A&&); // { dg-error "argument" }
+
+int test2_58()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_2_58(a); // { dg-error "lvalue" }
+ sink_2_58(ca); // { dg-error "lvalue" }
+ sink_2_58(va); // { dg-error "lvalue" }
+ sink_2_58(cva); // { dg-error "lvalue" }
+}
+
+six sink_2_67(const A&&); // { dg-message "candidate|argument" }
+seven sink_2_67(volatile A&&); // { dg-message "note|argument" }
int test2_67()
{
@@ -355,12 +418,44 @@ int test2_67()
volatile A va;
const volatile A cva = a;
sink_2_67(a); // { dg-error "ambiguous" }
+ sink_2_67(ca); // { dg-error "lvalue" }
+ sink_2_67(va); // { dg-error "lvalue" }
sink_2_67(cva); // { dg-error "no match" }
sink_2_67(source()); // { dg-error "ambiguous" }
sink_2_67(cv_source()); // { dg-error "no match" }
return 0;
}
+six sink_2_68(const A&&); // { dg-error "argument" }
+eight sink_2_68(const volatile A&&); // { dg-error "argument" }
+
+int test2_68()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_2_68(a); // { dg-error "lvalue" }
+ sink_2_68(ca); // { dg-error "lvalue" }
+ sink_2_68(va); // { dg-error "lvalue" }
+ sink_2_68(cva); // { dg-error "lvalue" }
+}
+
+seven sink_2_78(volatile A&&); // { dg-error "argument" }
+eight sink_2_78(const volatile A&&); // { dg-error "argument" }
+
+int test2_78()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_2_78(a); // { dg-error "lvalue" }
+ sink_2_78(ca); // { dg-error "lvalue" }
+ sink_2_78(va); // { dg-error "lvalue" }
+ sink_2_78(cva); // { dg-error "lvalue" }
+}
+
int main()
{
return test2_12() + test2_13() + test2_15() + test2_16() +
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv2p.C b/gcc/testsuite/g++.dg/cpp0x/rv2p.C
index 0d12aac..61c4fb0 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv2p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv2p.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -100,7 +100,6 @@ int test2_16()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_2_16(a)) == 1> t1;
- sa<sizeof(sink_2_16(ca)) == 6> t2;
sa<sizeof(sink_2_16(source())) == 6> t5;
sa<sizeof(sink_2_16(c_source())) == 6> t6;
return 0;
@@ -116,7 +115,6 @@ int test2_17()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_2_17(a)) == 1> t1;
- sa<sizeof(sink_2_17(va)) == 7> t3;
sa<sizeof(sink_2_17(source())) == 7> t5;
sa<sizeof(sink_2_17(v_source())) == 7> t7;
return 0;
@@ -132,9 +130,6 @@ int test2_18()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_2_18(a)) == 1> t1;
- sa<sizeof(sink_2_18(ca)) == 8> t2;
- sa<sizeof(sink_2_18(va)) == 8> t3;
- sa<sizeof(sink_2_18(cva)) == 8> t4;
sa<sizeof(sink_2_18(source())) == 8> t5;
sa<sizeof(sink_2_18(c_source())) == 8> t6;
sa<sizeof(sink_2_18(v_source())) == 8> t7;
@@ -221,7 +216,6 @@ int test2_27()
const volatile A cva = a;
sa<sizeof(sink_2_27(a)) == 2> t1;
sa<sizeof(sink_2_27(ca)) == 2> t2;
- sa<sizeof(sink_2_27(va)) == 7> t3;
sa<sizeof(sink_2_27(source())) == 7> t5;
sa<sizeof(sink_2_27(c_source())) == 2> t6;
sa<sizeof(sink_2_27(v_source())) == 7> t7;
@@ -239,8 +233,6 @@ int test2_28()
const volatile A cva = a;
sa<sizeof(sink_2_28(a)) == 2> t1;
sa<sizeof(sink_2_28(ca)) == 2> t2;
- sa<sizeof(sink_2_28(va)) == 8> t3;
- sa<sizeof(sink_2_28(cva)) == 8> t4;
sa<sizeof(sink_2_28(source())) == 8> t5;
sa<sizeof(sink_2_28(c_source())) == 8> t6;
sa<sizeof(sink_2_28(v_source())) == 8> t7;
@@ -293,7 +285,6 @@ int test2_36()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_2_36(a)) == 3> t1;
- sa<sizeof(sink_2_36(ca)) == 6> t2;
sa<sizeof(sink_2_36(va)) == 3> t3;
sa<sizeof(sink_2_36(source())) == 6> t5;
sa<sizeof(sink_2_36(c_source())) == 6> t6;
@@ -326,9 +317,7 @@ int test2_38()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_2_38(a)) == 3> t1;
- sa<sizeof(sink_2_38(ca)) == 8> t2;
sa<sizeof(sink_2_38(va)) == 3> t3;
- sa<sizeof(sink_2_38(cva)) == 8> t4;
sa<sizeof(sink_2_38(source())) == 8> t5;
sa<sizeof(sink_2_38(c_source())) == 8> t6;
sa<sizeof(sink_2_38(v_source())) == 8> t7;
@@ -425,8 +414,6 @@ int test2_56()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_2_56(a)) == 5> t1;
- sa<sizeof(sink_2_56(ca)) == 6> t2;
sa<sizeof(sink_2_56(source())) == 5> t5;
sa<sizeof(sink_2_56(c_source())) == 6> t6;
return 0;
@@ -441,8 +428,6 @@ int test2_57()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_2_57(a)) == 5> t1;
- sa<sizeof(sink_2_57(va)) == 7> t3;
sa<sizeof(sink_2_57(source())) == 5> t5;
sa<sizeof(sink_2_57(v_source())) == 7> t7;
return 0;
@@ -457,10 +442,6 @@ int test2_58()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_2_58(a)) == 5> t1;
- sa<sizeof(sink_2_58(ca)) == 8> t2;
- sa<sizeof(sink_2_58(va)) == 8> t3;
- sa<sizeof(sink_2_58(cva)) == 8> t4;
sa<sizeof(sink_2_58(source())) == 5> t5;
sa<sizeof(sink_2_58(c_source())) == 8> t6;
sa<sizeof(sink_2_58(v_source())) == 8> t7;
@@ -477,8 +458,6 @@ int test2_67()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_2_67(ca)) == 6> t2;
- sa<sizeof(sink_2_67(va)) == 7> t3;
sa<sizeof(sink_2_67(c_source())) == 6> t6;
sa<sizeof(sink_2_67(v_source())) == 7> t7;
return 0;
@@ -493,10 +472,6 @@ int test2_68()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_2_68(a)) == 6> t1;
- sa<sizeof(sink_2_68(ca)) == 6> t2;
- sa<sizeof(sink_2_68(va)) == 8> t3;
- sa<sizeof(sink_2_68(cva)) == 8> t4;
sa<sizeof(sink_2_68(source())) == 6> t5;
sa<sizeof(sink_2_68(c_source())) == 6> t6;
sa<sizeof(sink_2_68(v_source())) == 8> t7;
@@ -513,10 +488,6 @@ int test2_78()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_2_78(a)) == 7> t1;
- sa<sizeof(sink_2_78(ca)) == 8> t2;
- sa<sizeof(sink_2_78(va)) == 7> t3;
- sa<sizeof(sink_2_78(cva)) == 8> t4;
sa<sizeof(sink_2_78(source())) == 7> t5;
sa<sizeof(sink_2_78(c_source())) == 8> t6;
sa<sizeof(sink_2_78(v_source())) == 7> t7;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv3n.C b/gcc/testsuite/g++.dg/cpp0x/rv3n.C
index 84675b3..0c208ab 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv3n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv3n.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -97,7 +97,7 @@ int test3_126()
one sink_3_127( A&); // { dg-message "candidates" }
two sink_3_127(const A&); // { dg-message "note" }
-seven sink_3_127(volatile A&&); // { dg-message "note" }
+seven sink_3_127(volatile A&&); // { dg-message "" }
int test3_127()
{
@@ -105,11 +105,27 @@ int test3_127()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_3_127(va); // { dg-error "lvalue" }
sink_3_127(cva); // { dg-error "no match" }
sink_3_127(cv_source()); // { dg-error "no match" }
return 0;
}
+one sink_3_128( A&);
+two sink_3_128(const A&);
+eight sink_3_128(const volatile A&&); // { dg-message "" }
+
+int test3_128()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+
+ sink_3_128(va); // { dg-error "lvalue" }
+ sink_3_128(cva); // { dg-error "lvalue" }
+}
+
one sink_3_134( A&); // { dg-message "candidates" }
three sink_3_134(volatile A&); // { dg-message "note" }
four sink_3_134(const volatile A&); // { dg-message "note" }
@@ -147,7 +163,7 @@ int test3_135()
one sink_3_136( A&); // { dg-message "candidates" }
three sink_3_136(volatile A&); // { dg-message "note" }
-six sink_3_136(const A&&); // { dg-message "note" }
+six sink_3_136(const A&&); // { dg-message "" }
int test3_136()
{
@@ -155,6 +171,7 @@ int test3_136()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_3_136(ca); // { dg-error "lvalue" }
sink_3_136(cva); // { dg-error "no match" }
sink_3_136(v_source()); // { dg-error "no match" }
sink_3_136(cv_source()); // { dg-error "no match" }
@@ -178,6 +195,21 @@ int test3_137()
return 0;
}
+one sink_3_138( A&);
+three sink_3_138(volatile A&);
+eight sink_3_138(const volatile A&&); // { dg-message "" }
+
+int test3_138()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_138(ca); // { dg-error "lvalue" }
+ sink_3_138(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_3_145( A&); // { dg-message "candidates" }
four sink_3_145(const volatile A&); // { dg-message "note" }
five sink_3_145( A&&); // { dg-message "note" }
@@ -226,7 +258,7 @@ int test3_147()
one sink_3_156( A&); // { dg-message "candidates" }
five sink_3_156( A&&); // { dg-message "note" }
-six sink_3_156(const A&&); // { dg-message "note" }
+six sink_3_156(const A&&); // { dg-message "" }
int test3_156()
{
@@ -234,6 +266,7 @@ int test3_156()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_3_156(ca); // { dg-error "lvalue" }
sink_3_156(va); // { dg-error "no match" }
sink_3_156(cva); // { dg-error "no match" }
sink_3_156(v_source()); // { dg-error "no match" }
@@ -243,7 +276,7 @@ int test3_156()
one sink_3_157( A&); // { dg-message "candidates" }
five sink_3_157( A&&); // { dg-message "note" }
-seven sink_3_157(volatile A&&); // { dg-message "note" }
+seven sink_3_157(volatile A&&); // { dg-message "" }
int test3_157()
{
@@ -252,15 +285,32 @@ int test3_157()
volatile A va;
const volatile A cva = a;
sink_3_157(ca); // { dg-error "no match" }
+ sink_3_157(va); // { dg-error "lvalue" }
sink_3_157(cva); // { dg-error "no match" }
sink_3_157(c_source()); // { dg-error "no match" }
sink_3_157(cv_source()); // { dg-error "no match" }
return 0;
}
+one sink_3_158( A&);
+five sink_3_158( A&&);
+eight sink_3_158(const volatile A&&); // { dg-message "" }
+
+int test3_158()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_158(ca); // { dg-error "lvalue" }
+ sink_3_158(va); // { dg-error "lvalue" }
+ sink_3_158(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_3_167( A&); // { dg-message "candidates" }
-six sink_3_167(const A&&); // { dg-message "note" }
-seven sink_3_167(volatile A&&); // { dg-message "note" }
+six sink_3_167(const A&&); // { dg-message "" }
+seven sink_3_167(volatile A&&); // { dg-message "" }
int test3_167()
{
@@ -268,12 +318,46 @@ int test3_167()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_3_167(ca); // { dg-error "lvalue" }
+ sink_3_167(va); // { dg-error "lvalue" }
sink_3_167(cva); // { dg-error "no match" }
sink_3_167(source()); // { dg-error "ambiguous" }
sink_3_167(cv_source()); // { dg-error "no match" }
return 0;
}
+one sink_3_168( A&);
+six sink_3_168(const A&&); // { dg-message "" }
+eight sink_3_168(const volatile A&&); // { dg-message "" }
+
+int test3_168()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_168(ca); // { dg-error "lvalue" }
+ sink_3_168(va); // { dg-error "lvalue" }
+ sink_3_168(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+one sink_3_178( A&);
+seven sink_3_178(volatile A&&); // { dg-message "" }
+eight sink_3_178(const volatile A&&); // { dg-message "" }
+
+int test3_178()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_178(ca); // { dg-error "lvalue" }
+ sink_3_178(va); // { dg-error "lvalue" }
+ sink_3_178(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
two sink_3_234(const A&); // { dg-message "candidates" }
three sink_3_234(volatile A&); // { dg-message "note" }
four sink_3_234(const volatile A&); // { dg-message "note" }
@@ -342,7 +426,7 @@ int test3_237()
two sink_3_238(const A&); // { dg-message "candidates" }
three sink_3_238(volatile A&); // { dg-message "note" }
-eight sink_3_238(const volatile A&&); // { dg-message "note" }
+eight sink_3_238(const volatile A&&); // { dg-message "" }
int test3_238()
{
@@ -351,6 +435,7 @@ int test3_238()
volatile A va;
const volatile A cva = a;
sink_3_238(a); // { dg-error "ambiguous" }
+ sink_3_238(cva); // { dg-error "lvalue" }
return 0;
}
@@ -417,7 +502,7 @@ int test3_256()
two sink_3_257(const A&); // { dg-message "candidates" }
five sink_3_257( A&&); // { dg-message "note" }
-seven sink_3_257(volatile A&&); // { dg-message "note" }
+seven sink_3_257(volatile A&&); // { dg-message "" }
int test3_257()
{
@@ -425,14 +510,30 @@ int test3_257()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_3_257(va); // { dg-error "lvalue" }
sink_3_257(cva); // { dg-error "no match" }
sink_3_257(cv_source()); // { dg-error "no match" }
return 0;
}
+two sink_3_258(const A&);
+five sink_3_258( A&&);
+eight sink_3_258(const volatile A&&); // { dg-message "" }
+
+int test3_258()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_258(va); // { dg-error "lvalue" }
+ sink_3_258(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
two sink_3_267(const A&); // { dg-message "candidates" }
six sink_3_267(const A&&); // { dg-message "note" }
-seven sink_3_267(volatile A&&); // { dg-message "note" }
+seven sink_3_267(volatile A&&); // { dg-message "" }
int test3_267()
{
@@ -440,12 +541,43 @@ int test3_267()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_3_267(va); // { dg-error "lvalue" }
sink_3_267(cva); // { dg-error "no match" }
sink_3_267(source()); // { dg-error "ambiguous" }
sink_3_267(cv_source()); // { dg-error "no match" }
return 0;
}
+two sink_3_268(const A&);
+six sink_3_268(const A&&);
+eight sink_3_268(const volatile A&&); // { dg-message "" }
+
+int test3_268()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_268(va); // { dg-error "lvalue" }
+ sink_3_268(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+two sink_3_278(const A&);
+seven sink_3_278(volatile A&&); // { dg-message "" }
+eight sink_3_278(const volatile A&&); // { dg-message "" }
+
+int test3_278()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_278(va); // { dg-error "lvalue" }
+ sink_3_278(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
three sink_3_345(volatile A&); // { dg-message "candidates" }
four sink_3_345(const volatile A&); // { dg-message "note" }
five sink_3_345( A&&); // { dg-message "note" }
@@ -494,7 +626,7 @@ int test3_347()
three sink_3_356(volatile A&); // { dg-message "candidates" }
five sink_3_356( A&&); // { dg-message "note" }
-six sink_3_356(const A&&); // { dg-message "note" }
+six sink_3_356(const A&&); // { dg-message "" }
int test3_356()
{
@@ -502,6 +634,7 @@ int test3_356()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_3_356(ca); // { dg-error "lvalue" }
sink_3_356(cva); // { dg-error "no match" }
sink_3_356(v_source()); // { dg-error "no match" }
sink_3_356(cv_source()); // { dg-error "no match" }
@@ -525,8 +658,23 @@ int test3_357()
return 0;
}
+three sink_3_358(volatile A&);
+five sink_3_358( A&&);
+eight sink_3_358(const volatile A&&); // { dg-message "" }
+
+int test3_358()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_358(ca); // { dg-error "lvalue" }
+ sink_3_358(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
three sink_3_367(volatile A&); // { dg-message "candidates" }
-six sink_3_367(const A&&); // { dg-message "note" }
+six sink_3_367(const A&&); // { dg-message "" }
seven sink_3_367(volatile A&&); // { dg-message "note" }
int test3_367()
@@ -535,12 +683,43 @@ int test3_367()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_3_367(ca); // { dg-error "lvalue" }
sink_3_367(cva); // { dg-error "no match" }
sink_3_367(source()); // { dg-error "ambiguous" }
sink_3_367(cv_source()); // { dg-error "no match" }
return 0;
}
+three sink_3_368(volatile A&);
+six sink_3_368(const A&&); // { dg-message "" }
+eight sink_3_368(const volatile A&&); // { dg-message "" }
+
+int test3_368()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_368(ca); // { dg-error "lvalue" }
+ sink_3_368(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+three sink_3_378(volatile A&);
+seven sink_3_378(volatile A&&);
+eight sink_3_378(const volatile A&&); // { dg-message "" }
+
+int test3_378()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_378(ca); // { dg-error "lvalue" }
+ sink_3_378(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
four sink_3_456(const volatile A&); // { dg-message "candidates" }
five sink_3_456( A&&); // { dg-message "note" }
six sink_3_456(const A&&); // { dg-message "note" }
@@ -586,9 +765,9 @@ int test3_467()
return 0;
}
-five sink_3_567( A&&); // { dg-message "candidates" }
-six sink_3_567(const A&&); // { dg-message "note" }
-seven sink_3_567(volatile A&&); // { dg-message "note" }
+five sink_3_567( A&&); // { dg-message "" }
+six sink_3_567(const A&&); // { dg-message "" }
+seven sink_3_567(volatile A&&); // { dg-message "" }
int test3_567()
{
@@ -596,14 +775,51 @@ int test3_567()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_3_567(a); // { dg-error "lvalue" }
+ sink_3_567(ca); // { dg-error "lvalue" }
+ sink_3_567(va); // { dg-error "lvalue" }
sink_3_567(cva); // { dg-error "no match" }
sink_3_567(cv_source()); // { dg-error "no match" }
return 0;
}
-six sink_3_678(const A&&); // { dg-message "candidates" }
-seven sink_3_678(volatile A&&); // { dg-message "note" }
-eight sink_3_678(const volatile A&&); // { dg-message "note" }
+five sink_3_568( A&&); // { dg-message "" }
+six sink_3_568(const A&&); // { dg-message "" }
+eight sink_3_568(const volatile A&&); // { dg-message "" }
+
+int test3_568()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_568(a); // { dg-error "lvalue" }
+ sink_3_568(ca); // { dg-error "lvalue" }
+ sink_3_568(va); // { dg-error "lvalue" }
+ sink_3_568(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+five sink_3_578( A&&); // { dg-message "" }
+seven sink_3_578(volatile A&&); // { dg-message "" }
+eight sink_3_578(const volatile A&&); // { dg-message "" }
+
+int test3_578()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_578(a); // { dg-error "lvalue" }
+ sink_3_578(ca); // { dg-error "lvalue" }
+ sink_3_578(va); // { dg-error "lvalue" }
+ sink_3_578(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+six sink_3_678(const A&&); // { dg-message "" }
+seven sink_3_678(volatile A&&); // { dg-message "" }
+eight sink_3_678(const volatile A&&); // { dg-message "" }
int test3_678()
{
@@ -612,6 +828,9 @@ int test3_678()
volatile A va;
const volatile A cva = a;
sink_3_678(a); // { dg-error "ambiguous" }
+ sink_3_678(ca); // { dg-error "lvalue" }
+ sink_3_678(va); // { dg-error "lvalue" }
+ sink_3_678(cva); // { dg-error "lvalue" }
sink_3_678(source()); // { dg-error "ambiguous" }
return 0;
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv3p.C b/gcc/testsuite/g++.dg/cpp0x/rv3p.C
index c688b11..5ab171f2 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv3p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv3p.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -113,7 +113,6 @@ int test3_127()
const volatile A cva = a;
sa<sizeof(sink_3_127(a)) == 1> t1;
sa<sizeof(sink_3_127(ca)) == 2> t2;
- sa<sizeof(sink_3_127(va)) == 7> t3;
sa<sizeof(sink_3_127(source())) == 7> t5;
sa<sizeof(sink_3_127(c_source())) == 2> t6;
sa<sizeof(sink_3_127(v_source())) == 7> t7;
@@ -132,8 +131,6 @@ int test3_128()
const volatile A cva = a;
sa<sizeof(sink_3_128(a)) == 1> t1;
sa<sizeof(sink_3_128(ca)) == 2> t2;
- sa<sizeof(sink_3_128(va)) == 8> t3;
- sa<sizeof(sink_3_128(cva)) == 8> t4;
sa<sizeof(sink_3_128(source())) == 8> t5;
sa<sizeof(sink_3_128(c_source())) == 8> t6;
sa<sizeof(sink_3_128(v_source())) == 8> t7;
@@ -185,7 +182,6 @@ int test3_136()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_136(a)) == 1> t1;
- sa<sizeof(sink_3_136(ca)) == 6> t2;
sa<sizeof(sink_3_136(va)) == 3> t3;
sa<sizeof(sink_3_136(source())) == 6> t5;
sa<sizeof(sink_3_136(c_source())) == 6> t6;
@@ -220,9 +216,7 @@ int test3_138()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_138(a)) == 1> t1;
- sa<sizeof(sink_3_138(ca)) == 8> t2;
sa<sizeof(sink_3_138(va)) == 3> t3;
- sa<sizeof(sink_3_138(cva)) == 8> t4;
sa<sizeof(sink_3_138(source())) == 8> t5;
sa<sizeof(sink_3_138(c_source())) == 8> t6;
sa<sizeof(sink_3_138(v_source())) == 8> t7;
@@ -318,7 +312,6 @@ int test3_156()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_156(a)) == 1> t1;
- sa<sizeof(sink_3_156(ca)) == 6> t2;
sa<sizeof(sink_3_156(source())) == 5> t5;
sa<sizeof(sink_3_156(c_source())) == 6> t6;
return 0;
@@ -335,7 +328,6 @@ int test3_157()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_157(a)) == 1> t1;
- sa<sizeof(sink_3_157(va)) == 7> t3;
sa<sizeof(sink_3_157(source())) == 5> t5;
sa<sizeof(sink_3_157(v_source())) == 7> t7;
return 0;
@@ -352,9 +344,6 @@ int test3_158()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_158(a)) == 1> t1;
- sa<sizeof(sink_3_158(ca)) == 8> t2;
- sa<sizeof(sink_3_158(va)) == 8> t3;
- sa<sizeof(sink_3_158(cva)) == 8> t4;
sa<sizeof(sink_3_158(source())) == 5> t5;
sa<sizeof(sink_3_158(c_source())) == 8> t6;
sa<sizeof(sink_3_158(v_source())) == 8> t7;
@@ -373,8 +362,6 @@ int test3_167()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_167(a)) == 1> t1;
- sa<sizeof(sink_3_167(ca)) == 6> t2;
- sa<sizeof(sink_3_167(va)) == 7> t3;
sa<sizeof(sink_3_167(c_source())) == 6> t6;
sa<sizeof(sink_3_167(v_source())) == 7> t7;
return 0;
@@ -391,9 +378,6 @@ int test3_168()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_168(a)) == 1> t1;
- sa<sizeof(sink_3_168(ca)) == 6> t2;
- sa<sizeof(sink_3_168(va)) == 8> t3;
- sa<sizeof(sink_3_168(cva)) == 8> t4;
sa<sizeof(sink_3_168(source())) == 6> t5;
sa<sizeof(sink_3_168(c_source())) == 6> t6;
sa<sizeof(sink_3_168(v_source())) == 8> t7;
@@ -412,9 +396,6 @@ int test3_178()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_178(a)) == 1> t1;
- sa<sizeof(sink_3_178(ca)) == 8> t2;
- sa<sizeof(sink_3_178(va)) == 7> t3;
- sa<sizeof(sink_3_178(cva)) == 8> t4;
sa<sizeof(sink_3_178(source())) == 7> t5;
sa<sizeof(sink_3_178(c_source())) == 8> t6;
sa<sizeof(sink_3_178(v_source())) == 7> t7;
@@ -504,7 +485,6 @@ int test3_238()
const volatile A cva = a;
sa<sizeof(sink_3_238(ca)) == 2> t2;
sa<sizeof(sink_3_238(va)) == 3> t3;
- sa<sizeof(sink_3_238(cva)) == 8> t4;
sa<sizeof(sink_3_238(source())) == 8> t5;
sa<sizeof(sink_3_238(c_source())) == 8> t6;
sa<sizeof(sink_3_238(v_source())) == 8> t7;
@@ -620,7 +600,6 @@ int test3_257()
const volatile A cva = a;
sa<sizeof(sink_3_257(a)) == 2> t1;
sa<sizeof(sink_3_257(ca)) == 2> t2;
- sa<sizeof(sink_3_257(va)) == 7> t3;
sa<sizeof(sink_3_257(source())) == 5> t5;
sa<sizeof(sink_3_257(c_source())) == 2> t6;
sa<sizeof(sink_3_257(v_source())) == 7> t7;
@@ -639,8 +618,6 @@ int test3_258()
const volatile A cva = a;
sa<sizeof(sink_3_258(a)) == 2> t1;
sa<sizeof(sink_3_258(ca)) == 2> t2;
- sa<sizeof(sink_3_258(va)) == 8> t3;
- sa<sizeof(sink_3_258(cva)) == 8> t4;
sa<sizeof(sink_3_258(source())) == 5> t5;
sa<sizeof(sink_3_258(c_source())) == 8> t6;
sa<sizeof(sink_3_258(v_source())) == 8> t7;
@@ -660,7 +637,6 @@ int test3_267()
const volatile A cva = a;
sa<sizeof(sink_3_267(a)) == 2> t1;
sa<sizeof(sink_3_267(ca)) == 2> t2;
- sa<sizeof(sink_3_267(va)) == 7> t3;
sa<sizeof(sink_3_267(c_source())) == 6> t6;
sa<sizeof(sink_3_267(v_source())) == 7> t7;
return 0;
@@ -678,8 +654,6 @@ int test3_268()
const volatile A cva = a;
sa<sizeof(sink_3_268(a)) == 2> t1;
sa<sizeof(sink_3_268(ca)) == 2> t2;
- sa<sizeof(sink_3_268(va)) == 8> t3;
- sa<sizeof(sink_3_268(cva)) == 8> t4;
sa<sizeof(sink_3_268(source())) == 6> t5;
sa<sizeof(sink_3_268(c_source())) == 6> t6;
sa<sizeof(sink_3_268(v_source())) == 8> t7;
@@ -699,8 +673,6 @@ int test3_278()
const volatile A cva = a;
sa<sizeof(sink_3_278(a)) == 2> t1;
sa<sizeof(sink_3_278(ca)) == 2> t2;
- sa<sizeof(sink_3_278(va)) == 7> t3;
- sa<sizeof(sink_3_278(cva)) == 8> t4;
sa<sizeof(sink_3_278(source())) == 7> t5;
sa<sizeof(sink_3_278(c_source())) == 8> t6;
sa<sizeof(sink_3_278(v_source())) == 7> t7;
@@ -796,7 +768,6 @@ int test3_356()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_356(a)) == 3> t1;
- sa<sizeof(sink_3_356(ca)) == 6> t2;
sa<sizeof(sink_3_356(va)) == 3> t3;
sa<sizeof(sink_3_356(source())) == 5> t5;
sa<sizeof(sink_3_356(c_source())) == 6> t6;
@@ -831,9 +802,7 @@ int test3_358()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_358(a)) == 3> t1;
- sa<sizeof(sink_3_358(ca)) == 8> t2;
sa<sizeof(sink_3_358(va)) == 3> t3;
- sa<sizeof(sink_3_358(cva)) == 8> t4;
sa<sizeof(sink_3_358(source())) == 5> t5;
sa<sizeof(sink_3_358(c_source())) == 8> t6;
sa<sizeof(sink_3_358(v_source())) == 8> t7;
@@ -852,7 +821,6 @@ int test3_367()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_367(a)) == 3> t1;
- sa<sizeof(sink_3_367(ca)) == 6> t2;
sa<sizeof(sink_3_367(va)) == 3> t3;
sa<sizeof(sink_3_367(c_source())) == 6> t6;
sa<sizeof(sink_3_367(v_source())) == 7> t7;
@@ -870,9 +838,7 @@ int test3_368()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_368(a)) == 3> t1;
- sa<sizeof(sink_3_368(ca)) == 6> t2;
sa<sizeof(sink_3_368(va)) == 3> t3;
- sa<sizeof(sink_3_368(cva)) == 8> t4;
sa<sizeof(sink_3_368(source())) == 6> t5;
sa<sizeof(sink_3_368(c_source())) == 6> t6;
sa<sizeof(sink_3_368(v_source())) == 8> t7;
@@ -891,9 +857,7 @@ int test3_378()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_378(a)) == 3> t1;
- sa<sizeof(sink_3_378(ca)) == 8> t2;
sa<sizeof(sink_3_378(va)) == 3> t3;
- sa<sizeof(sink_3_378(cva)) == 8> t4;
sa<sizeof(sink_3_378(source())) == 7> t5;
sa<sizeof(sink_3_378(c_source())) == 8> t6;
sa<sizeof(sink_3_378(v_source())) == 7> t7;
@@ -1031,9 +995,6 @@ int test3_567()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_3_567(a)) == 5> t1;
- sa<sizeof(sink_3_567(ca)) == 6> t2;
- sa<sizeof(sink_3_567(va)) == 7> t3;
sa<sizeof(sink_3_567(source())) == 5> t5;
sa<sizeof(sink_3_567(c_source())) == 6> t6;
sa<sizeof(sink_3_567(v_source())) == 7> t7;
@@ -1050,10 +1011,6 @@ int test3_568()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_3_568(a)) == 5> t1;
- sa<sizeof(sink_3_568(ca)) == 6> t2;
- sa<sizeof(sink_3_568(va)) == 8> t3;
- sa<sizeof(sink_3_568(cva)) == 8> t4;
sa<sizeof(sink_3_568(source())) == 5> t5;
sa<sizeof(sink_3_568(c_source())) == 6> t6;
sa<sizeof(sink_3_568(v_source())) == 8> t7;
@@ -1071,10 +1028,6 @@ int test3_578()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_3_578(a)) == 5> t1;
- sa<sizeof(sink_3_578(ca)) == 8> t2;
- sa<sizeof(sink_3_578(va)) == 7> t3;
- sa<sizeof(sink_3_578(cva)) == 8> t4;
sa<sizeof(sink_3_578(source())) == 5> t5;
sa<sizeof(sink_3_578(c_source())) == 8> t6;
sa<sizeof(sink_3_578(v_source())) == 7> t7;
@@ -1092,9 +1045,6 @@ int test3_678()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_3_678(ca)) == 6> t2;
- sa<sizeof(sink_3_678(va)) == 7> t3;
- sa<sizeof(sink_3_678(cva)) == 8> t4;
sa<sizeof(sink_3_678(c_source())) == 6> t6;
sa<sizeof(sink_3_678(v_source())) == 7> t7;
sa<sizeof(sink_3_678(cv_source())) == 8> t8;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv4n.C b/gcc/testsuite/g++.dg/cpp0x/rv4n.C
index b88e3f7..cf627ae 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv4n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv4n.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -96,6 +96,21 @@ int test4_1237()
return 0;
}
+one sink_4_1238( A&);
+two sink_4_1238(const A&);
+three sink_4_1238(volatile A&);
+eight sink_4_1238(const volatile A&&); // { dg-message "" }
+
+int test4_1238()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_1238(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_4_1245( A&); // { dg-message "candidates" }
two sink_4_1245(const A&); // { dg-message "note" }
four sink_4_1245(const volatile A&); // { dg-message "note" }
@@ -164,7 +179,7 @@ int test4_1256()
one sink_4_1257( A&); // { dg-message "candidates" }
two sink_4_1257(const A&); // { dg-message "note" }
five sink_4_1257( A&&); // { dg-message "note" }
-seven sink_4_1257(volatile A&&); // { dg-message "note" }
+seven sink_4_1257(volatile A&&); // { dg-message "" }
int test4_1257()
{
@@ -172,15 +187,32 @@ int test4_1257()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_1257(va); // { dg-error "lvalue" }
sink_4_1257(cva); // { dg-error "no match" }
sink_4_1257(cv_source()); // { dg-error "no match" }
return 0;
}
+one sink_4_1258( A&);
+two sink_4_1258(const A&);
+five sink_4_1258( A&&);
+eight sink_4_1258(const volatile A&&); // { dg-message "" }
+
+int test4_1258()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_1258(va); // { dg-error "lvalue" }
+ sink_4_1258(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_4_1267( A&); // { dg-message "candidates" }
two sink_4_1267(const A&); // { dg-message "note" }
six sink_4_1267(const A&&); // { dg-message "note" }
-seven sink_4_1267(volatile A&&); // { dg-message "note" }
+seven sink_4_1267(volatile A&&); // { dg-message "" }
int test4_1267()
{
@@ -188,12 +220,45 @@ int test4_1267()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_1267(va); // { dg-error "lvalue" }
sink_4_1267(cva); // { dg-error "no match" }
sink_4_1267(source()); // { dg-error "ambiguous" }
sink_4_1267(cv_source()); // { dg-error "no match" }
return 0;
}
+one sink_4_1268( A&);
+two sink_4_1268(const A&);
+six sink_4_1268(const A&&);
+eight sink_4_1268(const volatile A&&); // { dg-message "" }
+
+int test4_1268()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_1268(va); // { dg-error "lvalue" }
+ sink_4_1268(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+one sink_4_1278( A&);
+two sink_4_1278(const A&);
+seven sink_4_1278(volatile A&&); // { dg-message "" }
+eight sink_4_1278(const volatile A&&); // { dg-message "" }
+
+int test4_1278()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_1278(va); // { dg-error "lvalue" }
+ sink_4_1278(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_4_1345( A&); // { dg-message "candidates" }
three sink_4_1345(volatile A&); // { dg-message "note" }
four sink_4_1345(const volatile A&); // { dg-message "note" }
@@ -246,7 +311,7 @@ int test4_1347()
one sink_4_1356( A&); // { dg-message "candidates" }
three sink_4_1356(volatile A&); // { dg-message "note" }
five sink_4_1356( A&&); // { dg-message "note" }
-six sink_4_1356(const A&&); // { dg-message "note" }
+six sink_4_1356(const A&&); // { dg-message "" }
int test4_1356()
{
@@ -254,6 +319,7 @@ int test4_1356()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_1356(ca); // { dg-error "lvalue" }
sink_4_1356(cva); // { dg-error "no match" }
sink_4_1356(v_source()); // { dg-error "no match" }
sink_4_1356(cv_source()); // { dg-error "no match" }
@@ -278,9 +344,25 @@ int test4_1357()
return 0;
}
+one sink_4_1358( A&);
+three sink_4_1358(volatile A&);
+five sink_4_1358( A&&);
+eight sink_4_1358(const volatile A&&); // { dg-message "" }
+
+int test4_1358()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_1358(ca); // { dg-error "lvalue" }
+ sink_4_1358(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_4_1367( A&); // { dg-message "candidates" }
three sink_4_1367(volatile A&); // { dg-message "note" }
-six sink_4_1367(const A&&); // { dg-message "note" }
+six sink_4_1367(const A&&); // { dg-message "" }
seven sink_4_1367(volatile A&&); // { dg-message "note" }
int test4_1367()
@@ -289,12 +371,45 @@ int test4_1367()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_1367(ca); // { dg-error "lvalue" }
sink_4_1367(cva); // { dg-error "no match" }
sink_4_1367(source()); // { dg-error "ambiguous" }
sink_4_1367(cv_source()); // { dg-error "no match" }
return 0;
}
+one sink_4_1368( A&);
+three sink_4_1368(volatile A&);
+six sink_4_1368(const A&&); // { dg-message "" }
+eight sink_4_1368(const volatile A&&); // { dg-message "" }
+
+int test4_1368()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_1368(ca); // { dg-error "lvalue" }
+ sink_4_1368(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+one sink_4_1378( A&);
+three sink_4_1378(volatile A&);
+seven sink_4_1378(volatile A&&);
+eight sink_4_1378(const volatile A&&); // { dg-message "" }
+
+int test4_1378()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_1378(ca); // { dg-error "lvalue" }
+ sink_4_1378(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_4_1456( A&); // { dg-message "candidates" }
four sink_4_1456(const volatile A&); // { dg-message "note" }
five sink_4_1456( A&&); // { dg-message "note" }
@@ -345,8 +460,8 @@ int test4_1467()
one sink_4_1567( A&); // { dg-message "candidates" }
five sink_4_1567( A&&); // { dg-message "note" }
-six sink_4_1567(const A&&); // { dg-message "note" }
-seven sink_4_1567(volatile A&&); // { dg-message "note" }
+six sink_4_1567(const A&&); // { dg-message "" }
+seven sink_4_1567(volatile A&&); // { dg-message "" }
int test4_1567()
{
@@ -354,15 +469,51 @@ int test4_1567()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_1567(ca); // { dg-error "lvalue" }
+ sink_4_1567(va); // { dg-error "lvalue" }
sink_4_1567(cva); // { dg-error "no match" }
sink_4_1567(cv_source()); // { dg-error "no match" }
return 0;
}
+one sink_4_1568( A&);
+five sink_4_1568( A&&);
+six sink_4_1568(const A&&); // { dg-message "" }
+eight sink_4_1568(const volatile A&&); // { dg-message "" }
+
+int test4_1568()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_1568(ca); // { dg-error "lvalue" }
+ sink_4_1568(va); // { dg-error "lvalue" }
+ sink_4_1568(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+one sink_4_1578( A&);
+five sink_4_1578( A&&);
+seven sink_4_1578(volatile A&&); // { dg-message "" }
+eight sink_4_1578(const volatile A&&); // { dg-message "" }
+
+int test4_1578()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_1578(ca); // { dg-error "lvalue" }
+ sink_4_1578(va); // { dg-error "lvalue" }
+ sink_4_1578(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_4_1678( A&);
-six sink_4_1678(const A&&); // { dg-message "candidates" }
-seven sink_4_1678(volatile A&&); // { dg-message "note" }
-eight sink_4_1678(const volatile A&&); // { dg-message "note" }
+six sink_4_1678(const A&&); // { dg-message "" }
+seven sink_4_1678(volatile A&&); // { dg-message "" }
+eight sink_4_1678(const volatile A&&); // { dg-message "" }
int test4_1678()
{
@@ -370,6 +521,9 @@ int test4_1678()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_1678(ca); // { dg-error "lvalue" }
+ sink_4_1678(va); // { dg-error "lvalue" }
+ sink_4_1678(cva); // { dg-error "lvalue" }
sink_4_1678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -477,7 +631,7 @@ int test4_2357()
two sink_4_2358(const A&); // { dg-message "candidates" }
three sink_4_2358(volatile A&); // { dg-message "note" }
five sink_4_2358( A&&); // { dg-message "note" }
-eight sink_4_2358(const volatile A&&); // { dg-message "note" }
+eight sink_4_2358(const volatile A&&); // { dg-message "" }
int test4_2358()
{
@@ -486,6 +640,7 @@ int test4_2358()
volatile A va;
const volatile A cva = a;
sink_4_2358(a); // { dg-error "ambiguous" }
+ sink_4_2358(cva); // { dg-error "lvalue" }
return 0;
}
@@ -510,7 +665,7 @@ int test4_2367()
two sink_4_2368(const A&); // { dg-message "candidates" }
three sink_4_2368(volatile A&); // { dg-message "note" }
six sink_4_2368(const A&&); // { dg-message "note" }
-eight sink_4_2368(const volatile A&&); // { dg-message "note" }
+eight sink_4_2368(const volatile A&&); // { dg-message "" }
int test4_2368()
{
@@ -519,13 +674,14 @@ int test4_2368()
volatile A va;
const volatile A cva = a;
sink_4_2368(a); // { dg-error "ambiguous" }
+ sink_4_2368(cva); // { dg-error "lvalue" }
return 0;
}
two sink_4_2378(const A&); // { dg-message "candidates" }
three sink_4_2378(volatile A&); // { dg-message "note" }
seven sink_4_2378(volatile A&&); // { dg-message "note" }
-eight sink_4_2378(const volatile A&&); // { dg-message "note" }
+eight sink_4_2378(const volatile A&&); // { dg-message "" }
int test4_2378()
{
@@ -534,6 +690,7 @@ int test4_2378()
volatile A va;
const volatile A cva = a;
sink_4_2378(a); // { dg-error "ambiguous" }
+ sink_4_2378(cva); // { dg-error "lvalue" }
return 0;
}
@@ -587,7 +744,7 @@ int test4_2467()
two sink_4_2567(const A&); // { dg-message "candidates" }
five sink_4_2567( A&&); // { dg-message "note" }
six sink_4_2567(const A&&); // { dg-message "note" }
-seven sink_4_2567(volatile A&&); // { dg-message "note" }
+seven sink_4_2567(volatile A&&); // { dg-message "" }
int test4_2567()
{
@@ -595,15 +752,48 @@ int test4_2567()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_2567(va); // { dg-error "lvalue" }
sink_4_2567(cva); // { dg-error "no match" }
sink_4_2567(cv_source()); // { dg-error "no match" }
return 0;
}
+two sink_4_2568(const A&);
+five sink_4_2568( A&&);
+six sink_4_2568(const A&&);
+eight sink_4_2568(const volatile A&&); // { dg-message "" }
+
+int test4_2568()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_2568(va); // { dg-error "lvalue" }
+ sink_4_2568(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+two sink_4_2578(const A&);
+five sink_4_2578( A&&);
+seven sink_4_2578(volatile A&&); // { dg-message "" }
+eight sink_4_2578(const volatile A&&); // { dg-message "" }
+
+int test4_2578()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_2578(va); // { dg-error "lvalue" }
+ sink_4_2578(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
two sink_4_2678(const A&); // { dg-message "candidates" }
six sink_4_2678(const A&&); // { dg-message "note" }
-seven sink_4_2678(volatile A&&); // { dg-message "note" }
-eight sink_4_2678(const volatile A&&); // { dg-message "note" }
+seven sink_4_2678(volatile A&&); // { dg-message "" }
+eight sink_4_2678(const volatile A&&); // { dg-message "" }
int test4_2678()
{
@@ -611,6 +801,8 @@ int test4_2678()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_2678(va); // { dg-error "lvalue" }
+ sink_4_2678(cva); // { dg-error "lvalue" }
sink_4_2678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -665,7 +857,7 @@ int test4_3467()
three sink_4_3567(volatile A&); // { dg-message "candidates" }
five sink_4_3567( A&&); // { dg-message "note" }
-six sink_4_3567(const A&&); // { dg-message "note" }
+six sink_4_3567(const A&&); // { dg-message "" }
seven sink_4_3567(volatile A&&); // { dg-message "note" }
int test4_3567()
@@ -674,15 +866,48 @@ int test4_3567()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_3567(ca); // { dg-error "lvalue" }
sink_4_3567(cva); // { dg-error "no match" }
sink_4_3567(cv_source()); // { dg-error "no match" }
return 0;
}
+three sink_4_3568(volatile A&);
+five sink_4_3568( A&&);
+six sink_4_3568(const A&&); // { dg-message "" }
+eight sink_4_3568(const volatile A&&); // { dg-message "" }
+
+int test4_3568()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_3568(ca); // { dg-error "lvalue" }
+ sink_4_3568(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+three sink_4_3578(volatile A&);
+five sink_4_3578( A&&);
+seven sink_4_3578(volatile A&&);
+eight sink_4_3578(const volatile A&&); // { dg-message "" }
+
+int test4_3578()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_3578(ca); // { dg-error "lvalue" }
+ sink_4_3578(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
three sink_4_3678(volatile A&);
-six sink_4_3678(const A&&); // { dg-message "candidates" }
+six sink_4_3678(const A&&); // { dg-message "" }
seven sink_4_3678(volatile A&&); // { dg-message "note" }
-eight sink_4_3678(const volatile A&&); // { dg-message "note" }
+eight sink_4_3678(const volatile A&&); // { dg-message "" }
int test4_3678()
{
@@ -690,6 +915,8 @@ int test4_3678()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_3678(ca); // { dg-error "lvalue" }
+ sink_4_3678(cva); // { dg-error "lvalue" }
sink_4_3678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -724,6 +951,24 @@ int test4_4678()
return 0;
}
+five sink_4_5678( A&&); // { dg-message "" }
+six sink_4_5678(const A&&); // { dg-message "" }
+seven sink_4_5678(volatile A&&); // { dg-message "" }
+eight sink_4_5678(const volatile A&&); // { dg-message "" }
+
+int test4_5678()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_5678(a); // { dg-error "lvalue" }
+ sink_4_5678(ca); // { dg-error "lvalue" }
+ sink_4_5678(va); // { dg-error "lvalue" }
+ sink_4_5678(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
int main()
{
return test4_1235() + test4_1236() + test4_1237() + test4_1256() + test4_1257() +
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv4p.C b/gcc/testsuite/g++.dg/cpp0x/rv4p.C
index a486e75..03ad973 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv4p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv4p.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -122,7 +122,6 @@ int test4_1238()
sa<sizeof(sink_4_1238(a)) == 1> t1;
sa<sizeof(sink_4_1238(ca)) == 2> t2;
sa<sizeof(sink_4_1238(va)) == 3> t3;
- sa<sizeof(sink_4_1238(cva)) == 8> t4;
sa<sizeof(sink_4_1238(source())) == 8> t5;
sa<sizeof(sink_4_1238(c_source())) == 8> t6;
sa<sizeof(sink_4_1238(v_source())) == 8> t7;
@@ -244,7 +243,6 @@ int test4_1257()
const volatile A cva = a;
sa<sizeof(sink_4_1257(a)) == 1> t1;
sa<sizeof(sink_4_1257(ca)) == 2> t2;
- sa<sizeof(sink_4_1257(va)) == 7> t3;
sa<sizeof(sink_4_1257(source())) == 5> t5;
sa<sizeof(sink_4_1257(c_source())) == 2> t6;
sa<sizeof(sink_4_1257(v_source())) == 7> t7;
@@ -264,8 +262,6 @@ int test4_1258()
const volatile A cva = a;
sa<sizeof(sink_4_1258(a)) == 1> t1;
sa<sizeof(sink_4_1258(ca)) == 2> t2;
- sa<sizeof(sink_4_1258(va)) == 8> t3;
- sa<sizeof(sink_4_1258(cva)) == 8> t4;
sa<sizeof(sink_4_1258(source())) == 5> t5;
sa<sizeof(sink_4_1258(c_source())) == 8> t6;
sa<sizeof(sink_4_1258(v_source())) == 8> t7;
@@ -286,7 +282,6 @@ int test4_1267()
const volatile A cva = a;
sa<sizeof(sink_4_1267(a)) == 1> t1;
sa<sizeof(sink_4_1267(ca)) == 2> t2;
- sa<sizeof(sink_4_1267(va)) == 7> t3;
sa<sizeof(sink_4_1267(c_source())) == 6> t6;
sa<sizeof(sink_4_1267(v_source())) == 7> t7;
return 0;
@@ -305,8 +300,6 @@ int test4_1268()
const volatile A cva = a;
sa<sizeof(sink_4_1268(a)) == 1> t1;
sa<sizeof(sink_4_1268(ca)) == 2> t2;
- sa<sizeof(sink_4_1268(va)) == 8> t3;
- sa<sizeof(sink_4_1268(cva)) == 8> t4;
sa<sizeof(sink_4_1268(source())) == 6> t5;
sa<sizeof(sink_4_1268(c_source())) == 6> t6;
sa<sizeof(sink_4_1268(v_source())) == 8> t7;
@@ -327,8 +320,6 @@ int test4_1278()
const volatile A cva = a;
sa<sizeof(sink_4_1278(a)) == 1> t1;
sa<sizeof(sink_4_1278(ca)) == 2> t2;
- sa<sizeof(sink_4_1278(va)) == 7> t3;
- sa<sizeof(sink_4_1278(cva)) == 8> t4;
sa<sizeof(sink_4_1278(source())) == 7> t5;
sa<sizeof(sink_4_1278(c_source())) == 8> t6;
sa<sizeof(sink_4_1278(v_source())) == 7> t7;
@@ -429,7 +420,6 @@ int test4_1356()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_1356(a)) == 1> t1;
- sa<sizeof(sink_4_1356(ca)) == 6> t2;
sa<sizeof(sink_4_1356(va)) == 3> t3;
sa<sizeof(sink_4_1356(source())) == 5> t5;
sa<sizeof(sink_4_1356(c_source())) == 6> t6;
@@ -466,9 +456,7 @@ int test4_1358()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_1358(a)) == 1> t1;
- sa<sizeof(sink_4_1358(ca)) == 8> t2;
sa<sizeof(sink_4_1358(va)) == 3> t3;
- sa<sizeof(sink_4_1358(cva)) == 8> t4;
sa<sizeof(sink_4_1358(source())) == 5> t5;
sa<sizeof(sink_4_1358(c_source())) == 8> t6;
sa<sizeof(sink_4_1358(v_source())) == 8> t7;
@@ -488,7 +476,6 @@ int test4_1367()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_1367(a)) == 1> t1;
- sa<sizeof(sink_4_1367(ca)) == 6> t2;
sa<sizeof(sink_4_1367(va)) == 3> t3;
sa<sizeof(sink_4_1367(c_source())) == 6> t6;
sa<sizeof(sink_4_1367(v_source())) == 7> t7;
@@ -507,9 +494,7 @@ int test4_1368()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_1368(a)) == 1> t1;
- sa<sizeof(sink_4_1368(ca)) == 6> t2;
sa<sizeof(sink_4_1368(va)) == 3> t3;
- sa<sizeof(sink_4_1368(cva)) == 8> t4;
sa<sizeof(sink_4_1368(source())) == 6> t5;
sa<sizeof(sink_4_1368(c_source())) == 6> t6;
sa<sizeof(sink_4_1368(v_source())) == 8> t7;
@@ -529,9 +514,7 @@ int test4_1378()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_1378(a)) == 1> t1;
- sa<sizeof(sink_4_1378(ca)) == 8> t2;
sa<sizeof(sink_4_1378(va)) == 3> t3;
- sa<sizeof(sink_4_1378(cva)) == 8> t4;
sa<sizeof(sink_4_1378(source())) == 7> t5;
sa<sizeof(sink_4_1378(c_source())) == 8> t6;
sa<sizeof(sink_4_1378(v_source())) == 7> t7;
@@ -677,8 +660,6 @@ int test4_1567()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_1567(a)) == 1> t1;
- sa<sizeof(sink_4_1567(ca)) == 6> t2;
- sa<sizeof(sink_4_1567(va)) == 7> t3;
sa<sizeof(sink_4_1567(source())) == 5> t5;
sa<sizeof(sink_4_1567(c_source())) == 6> t6;
sa<sizeof(sink_4_1567(v_source())) == 7> t7;
@@ -697,9 +678,6 @@ int test4_1568()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_1568(a)) == 1> t1;
- sa<sizeof(sink_4_1568(ca)) == 6> t2;
- sa<sizeof(sink_4_1568(va)) == 8> t3;
- sa<sizeof(sink_4_1568(cva)) == 8> t4;
sa<sizeof(sink_4_1568(source())) == 5> t5;
sa<sizeof(sink_4_1568(c_source())) == 6> t6;
sa<sizeof(sink_4_1568(v_source())) == 8> t7;
@@ -719,9 +697,6 @@ int test4_1578()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_1578(a)) == 1> t1;
- sa<sizeof(sink_4_1578(ca)) == 8> t2;
- sa<sizeof(sink_4_1578(va)) == 7> t3;
- sa<sizeof(sink_4_1578(cva)) == 8> t4;
sa<sizeof(sink_4_1578(source())) == 5> t5;
sa<sizeof(sink_4_1578(c_source())) == 8> t6;
sa<sizeof(sink_4_1578(v_source())) == 7> t7;
@@ -741,9 +716,6 @@ int test4_1678()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_1678(a)) == 1> t1;
- sa<sizeof(sink_4_1678(ca)) == 6> t2;
- sa<sizeof(sink_4_1678(va)) == 7> t3;
- sa<sizeof(sink_4_1678(cva)) == 8> t4;
sa<sizeof(sink_4_1678(c_source())) == 6> t6;
sa<sizeof(sink_4_1678(v_source())) == 7> t7;
sa<sizeof(sink_4_1678(cv_source())) == 8> t8;
@@ -879,7 +851,6 @@ int test4_2358()
const volatile A cva = a;
sa<sizeof(sink_4_2358(ca)) == 2> t2;
sa<sizeof(sink_4_2358(va)) == 3> t3;
- sa<sizeof(sink_4_2358(cva)) == 8> t4;
sa<sizeof(sink_4_2358(source())) == 5> t5;
sa<sizeof(sink_4_2358(c_source())) == 8> t6;
sa<sizeof(sink_4_2358(v_source())) == 8> t7;
@@ -918,7 +889,6 @@ int test4_2368()
const volatile A cva = a;
sa<sizeof(sink_4_2368(ca)) == 2> t2;
sa<sizeof(sink_4_2368(va)) == 3> t3;
- sa<sizeof(sink_4_2368(cva)) == 8> t4;
sa<sizeof(sink_4_2368(source())) == 6> t5;
sa<sizeof(sink_4_2368(c_source())) == 6> t6;
sa<sizeof(sink_4_2368(v_source())) == 8> t7;
@@ -939,7 +909,6 @@ int test4_2378()
const volatile A cva = a;
sa<sizeof(sink_4_2378(ca)) == 2> t2;
sa<sizeof(sink_4_2378(va)) == 3> t3;
- sa<sizeof(sink_4_2378(cva)) == 8> t4;
sa<sizeof(sink_4_2378(source())) == 7> t5;
sa<sizeof(sink_4_2378(c_source())) == 8> t6;
sa<sizeof(sink_4_2378(v_source())) == 7> t7;
@@ -1087,7 +1056,6 @@ int test4_2567()
const volatile A cva = a;
sa<sizeof(sink_4_2567(a)) == 2> t1;
sa<sizeof(sink_4_2567(ca)) == 2> t2;
- sa<sizeof(sink_4_2567(va)) == 7> t3;
sa<sizeof(sink_4_2567(source())) == 5> t5;
sa<sizeof(sink_4_2567(c_source())) == 6> t6;
sa<sizeof(sink_4_2567(v_source())) == 7> t7;
@@ -1107,8 +1075,6 @@ int test4_2568()
const volatile A cva = a;
sa<sizeof(sink_4_2568(a)) == 2> t1;
sa<sizeof(sink_4_2568(ca)) == 2> t2;
- sa<sizeof(sink_4_2568(va)) == 8> t3;
- sa<sizeof(sink_4_2568(cva)) == 8> t4;
sa<sizeof(sink_4_2568(source())) == 5> t5;
sa<sizeof(sink_4_2568(c_source())) == 6> t6;
sa<sizeof(sink_4_2568(v_source())) == 8> t7;
@@ -1129,8 +1095,6 @@ int test4_2578()
const volatile A cva = a;
sa<sizeof(sink_4_2578(a)) == 2> t1;
sa<sizeof(sink_4_2578(ca)) == 2> t2;
- sa<sizeof(sink_4_2578(va)) == 7> t3;
- sa<sizeof(sink_4_2578(cva)) == 8> t4;
sa<sizeof(sink_4_2578(source())) == 5> t5;
sa<sizeof(sink_4_2578(c_source())) == 8> t6;
sa<sizeof(sink_4_2578(v_source())) == 7> t7;
@@ -1151,8 +1115,6 @@ int test4_2678()
const volatile A cva = a;
sa<sizeof(sink_4_2678(a)) == 2> t1;
sa<sizeof(sink_4_2678(ca)) == 2> t2;
- sa<sizeof(sink_4_2678(va)) == 7> t3;
- sa<sizeof(sink_4_2678(cva)) == 8> t4;
sa<sizeof(sink_4_2678(c_source())) == 6> t6;
sa<sizeof(sink_4_2678(v_source())) == 7> t7;
sa<sizeof(sink_4_2678(cv_source())) == 8> t8;
@@ -1297,7 +1259,6 @@ int test4_3567()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_3567(a)) == 3> t1;
- sa<sizeof(sink_4_3567(ca)) == 6> t2;
sa<sizeof(sink_4_3567(va)) == 3> t3;
sa<sizeof(sink_4_3567(source())) == 5> t5;
sa<sizeof(sink_4_3567(c_source())) == 6> t6;
@@ -1317,9 +1278,7 @@ int test4_3568()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_3568(a)) == 3> t1;
- sa<sizeof(sink_4_3568(ca)) == 6> t2;
sa<sizeof(sink_4_3568(va)) == 3> t3;
- sa<sizeof(sink_4_3568(cva)) == 8> t4;
sa<sizeof(sink_4_3568(source())) == 5> t5;
sa<sizeof(sink_4_3568(c_source())) == 6> t6;
sa<sizeof(sink_4_3568(v_source())) == 8> t7;
@@ -1339,9 +1298,7 @@ int test4_3578()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_3578(a)) == 3> t1;
- sa<sizeof(sink_4_3578(ca)) == 8> t2;
sa<sizeof(sink_4_3578(va)) == 3> t3;
- sa<sizeof(sink_4_3578(cva)) == 8> t4;
sa<sizeof(sink_4_3578(source())) == 5> t5;
sa<sizeof(sink_4_3578(c_source())) == 8> t6;
sa<sizeof(sink_4_3578(v_source())) == 7> t7;
@@ -1361,9 +1318,7 @@ int test4_3678()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_3678(a)) == 3> t1;
- sa<sizeof(sink_4_3678(ca)) == 6> t2;
sa<sizeof(sink_4_3678(va)) == 3> t3;
- sa<sizeof(sink_4_3678(cva)) == 8> t4;
sa<sizeof(sink_4_3678(c_source())) == 6> t6;
sa<sizeof(sink_4_3678(v_source())) == 7> t7;
sa<sizeof(sink_4_3678(cv_source())) == 8> t8;
@@ -1467,10 +1422,6 @@ int test4_5678()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_4_5678(a)) == 5> t1;
- sa<sizeof(sink_4_5678(ca)) == 6> t2;
- sa<sizeof(sink_4_5678(va)) == 7> t3;
- sa<sizeof(sink_4_5678(cva)) == 8> t4;
sa<sizeof(sink_4_5678(source())) == 5> t5;
sa<sizeof(sink_4_5678(c_source())) == 6> t6;
sa<sizeof(sink_4_5678(v_source())) == 7> t7;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv5n.C b/gcc/testsuite/g++.dg/cpp0x/rv5n.C
index 14128b2..c31a30b 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv5n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv5n.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -115,6 +115,22 @@ int test5_12357()
return 0;
}
+one sink_5_12358( A&);
+two sink_5_12358(const A&);
+three sink_5_12358(volatile A&);
+five sink_5_12358( A&&);
+eight sink_5_12358(const volatile A&&); // { dg-message "" }
+
+int test5_12358()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_12358(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_5_12367( A&); // { dg-message "candidates" }
two sink_5_12367(const A&); // { dg-message "note" }
three sink_5_12367(volatile A&); // { dg-message "note" }
@@ -133,6 +149,38 @@ int test5_12367()
return 0;
}
+one sink_5_12368( A&);
+two sink_5_12368(const A&);
+three sink_5_12368(volatile A&);
+six sink_5_12368(const A&&);
+eight sink_5_12368(const volatile A&&); // { dg-message "" }
+
+int test5_12368()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_12368(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+one sink_5_12378( A&);
+two sink_5_12378(const A&);
+three sink_5_12378(volatile A&);
+seven sink_5_12378(volatile A&&);
+eight sink_5_12378(const volatile A&&); // { dg-message "" }
+
+int test5_12378()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_12378(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_5_12456( A&); // { dg-message "candidates" }
two sink_5_12456(const A&); // { dg-message "note" }
four sink_5_12456(const volatile A&); // { dg-message "note" }
@@ -187,7 +235,7 @@ one sink_5_12567( A&); // { dg-message "candidates" }
two sink_5_12567(const A&); // { dg-message "note" }
five sink_5_12567( A&&); // { dg-message "note" }
six sink_5_12567(const A&&); // { dg-message "note" }
-seven sink_5_12567(volatile A&&); // { dg-message "note" }
+seven sink_5_12567(volatile A&&); // { dg-message "" }
int test5_12567()
{
@@ -195,16 +243,51 @@ int test5_12567()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_5_12567(va); // { dg-error "lvalue" }
sink_5_12567(cva); // { dg-error "no match" }
sink_5_12567(cv_source()); // { dg-error "no match" }
return 0;
}
+one sink_5_12568( A&);
+two sink_5_12568(const A&);
+five sink_5_12568( A&&);
+six sink_5_12568(const A&&);
+eight sink_5_12568(const volatile A&&); // { dg-message "" }
+
+int test5_12568()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_12568(va); // { dg-error "lvalue" }
+ sink_5_12568(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+one sink_5_12578( A&);
+two sink_5_12578(const A&);
+five sink_5_12578( A&&);
+seven sink_5_12578(volatile A&&); // { dg-message "" }
+eight sink_5_12578(const volatile A&&); // { dg-message "" }
+
+int test5_12578()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_12578(va); // { dg-error "lvalue" }
+ sink_5_12578(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_5_12678( A&);
two sink_5_12678(const A&); // { dg-message "candidates" }
six sink_5_12678(const A&&); // { dg-message "note" }
-seven sink_5_12678(volatile A&&); // { dg-message "note" }
-eight sink_5_12678(const volatile A&&); // { dg-message "note" }
+seven sink_5_12678(volatile A&&); // { dg-message "" }
+eight sink_5_12678(const volatile A&&); // { dg-message "" }
int test5_12678()
{
@@ -212,6 +295,8 @@ int test5_12678()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_5_12678(va); // { dg-error "lvalue" }
+ sink_5_12678(cva); // { dg-error "lvalue" }
sink_5_12678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -270,7 +355,7 @@ int test5_13467()
one sink_5_13567( A&); // { dg-message "candidates" }
three sink_5_13567(volatile A&); // { dg-message "note" }
five sink_5_13567( A&&); // { dg-message "note" }
-six sink_5_13567(const A&&); // { dg-message "note" }
+six sink_5_13567(const A&&); // { dg-message "" }
seven sink_5_13567(volatile A&&); // { dg-message "note" }
int test5_13567()
@@ -279,16 +364,51 @@ int test5_13567()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_5_13567(ca); // { dg-error "lvalue" }
sink_5_13567(cva); // { dg-error "no match" }
sink_5_13567(cv_source()); // { dg-error "no match" }
return 0;
}
+one sink_5_13568( A&);
+three sink_5_13568(volatile A&);
+five sink_5_13568( A&&);
+six sink_5_13568(const A&&); // { dg-message "" }
+eight sink_5_13568(const volatile A&&); // { dg-message "" }
+
+int test5_13568()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_13568(ca); // { dg-error "lvalue" }
+ sink_5_13568(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+one sink_5_13578( A&);
+three sink_5_13578(volatile A&);
+five sink_5_13578( A&&);
+seven sink_5_13578(volatile A&&);
+eight sink_5_13578(const volatile A&&); // { dg-message "" }
+
+int test5_13578()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_13578(ca); // { dg-error "lvalue" }
+ sink_5_13578(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_5_13678( A&);
three sink_5_13678(volatile A&);
-six sink_5_13678(const A&&); // { dg-message "candidates" }
+six sink_5_13678(const A&&); // { dg-message "" }
seven sink_5_13678(volatile A&&); // { dg-message "note" }
-eight sink_5_13678(const volatile A&&); // { dg-message "note" }
+eight sink_5_13678(const volatile A&&); // { dg-message "" }
int test5_13678()
{
@@ -296,6 +416,8 @@ int test5_13678()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_5_13678(ca); // { dg-error "lvalue" }
+ sink_5_13678(cva); // { dg-error "lvalue" }
sink_5_13678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -332,6 +454,24 @@ int test5_14678()
return 0;
}
+one sink_5_15678( A&);
+five sink_5_15678( A&&);
+six sink_5_15678(const A&&); // { dg-message "" }
+seven sink_5_15678(volatile A&&); // { dg-message "" }
+eight sink_5_15678(const volatile A&&); // { dg-message "" }
+
+int test5_15678()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_15678(ca); // { dg-error "lvalue" }
+ sink_5_15678(va); // { dg-error "lvalue" }
+ sink_5_15678(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
two sink_5_23456(const A&); // { dg-message "candidates" }
three sink_5_23456(volatile A&); // { dg-message "note" }
four sink_5_23456(const volatile A&); // { dg-message "note" }
@@ -455,7 +595,7 @@ two sink_5_23568(const A&); // { dg-message "candidates" }
three sink_5_23568(volatile A&); // { dg-message "note" }
five sink_5_23568( A&&); // { dg-message "note" }
six sink_5_23568(const A&&); // { dg-message "note" }
-eight sink_5_23568(const volatile A&&); // { dg-message "note" }
+eight sink_5_23568(const volatile A&&); // { dg-message "" }
int test5_23568()
{
@@ -463,6 +603,7 @@ int test5_23568()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_5_23568(cva); // { dg-error "lvalue" }
sink_5_23568(a); // { dg-error "ambiguous" }
return 0;
}
@@ -471,7 +612,7 @@ two sink_5_23578(const A&); // { dg-message "candidates" }
three sink_5_23578(volatile A&); // { dg-message "note" }
five sink_5_23578( A&&); // { dg-message "note" }
seven sink_5_23578(volatile A&&); // { dg-message "note" }
-eight sink_5_23578(const volatile A&&); // { dg-message "note" }
+eight sink_5_23578(const volatile A&&); // { dg-message "" }
int test5_23578()
{
@@ -479,6 +620,7 @@ int test5_23578()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_5_23578(cva); // { dg-error "lvalue" }
sink_5_23578(a); // { dg-error "ambiguous" }
return 0;
}
@@ -487,7 +629,7 @@ two sink_5_23678(const A&); // { dg-message "candidates" }
three sink_5_23678(volatile A&); // { dg-message "note" }
six sink_5_23678(const A&&); // { dg-message "note" }
seven sink_5_23678(volatile A&&); // { dg-message "note" }
-eight sink_5_23678(const volatile A&&); // { dg-message "note" }
+eight sink_5_23678(const volatile A&&); // { dg-message "" }
int test5_23678()
{
@@ -496,6 +638,7 @@ int test5_23678()
volatile A va;
const volatile A cva = a;
sink_5_23678(a); // { dg-error "ambiguous" }
+ sink_5_23678(cva); // { dg-error "lvalue" }
sink_5_23678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -532,6 +675,23 @@ int test5_24678()
return 0;
}
+two sink_5_25678(const A&);
+five sink_5_25678( A&&);
+six sink_5_25678(const A&&);
+seven sink_5_25678(volatile A&&); // { dg-message "" }
+eight sink_5_25678(const volatile A&&); // { dg-message "" }
+
+int test5_25678()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_25678(va); // { dg-error "lvalue" }
+ sink_5_25678(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
three sink_5_34567(volatile A&); // { dg-message "candidates" }
four sink_5_34567(const volatile A&); // { dg-message "note" }
five sink_5_34567( A&&); // { dg-message "note" }
@@ -564,6 +724,23 @@ int test5_34678()
return 0;
}
+three sink_5_35678(volatile A&);
+five sink_5_35678( A&&);
+six sink_5_35678(const A&&); // { dg-message "" }
+seven sink_5_35678(volatile A&&);
+eight sink_5_35678(const volatile A&&); // { dg-message "" }
+
+int test5_35678()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_35678(ca); // { dg-error "lvalue" }
+ sink_5_35678(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
int main()
{
return test5_12356() + test5_12357() + test5_12367() + test5_12467() +
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv5p.C b/gcc/testsuite/g++.dg/cpp0x/rv5p.C
index a4d9167..7555867 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv5p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv5p.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -173,7 +173,6 @@ int test5_12358()
sa<sizeof(sink_5_12358(a)) == 1> t1;
sa<sizeof(sink_5_12358(ca)) == 2> t2;
sa<sizeof(sink_5_12358(va)) == 3> t3;
- sa<sizeof(sink_5_12358(cva)) == 8> t4;
sa<sizeof(sink_5_12358(source())) == 5> t5;
sa<sizeof(sink_5_12358(c_source())) == 8> t6;
sa<sizeof(sink_5_12358(v_source())) == 8> t7;
@@ -216,7 +215,6 @@ int test5_12368()
sa<sizeof(sink_5_12368(a)) == 1> t1;
sa<sizeof(sink_5_12368(ca)) == 2> t2;
sa<sizeof(sink_5_12368(va)) == 3> t3;
- sa<sizeof(sink_5_12368(cva)) == 8> t4;
sa<sizeof(sink_5_12368(source())) == 6> t5;
sa<sizeof(sink_5_12368(c_source())) == 6> t6;
sa<sizeof(sink_5_12368(v_source())) == 8> t7;
@@ -239,7 +237,6 @@ int test5_12378()
sa<sizeof(sink_5_12378(a)) == 1> t1;
sa<sizeof(sink_5_12378(ca)) == 2> t2;
sa<sizeof(sink_5_12378(va)) == 3> t3;
- sa<sizeof(sink_5_12378(cva)) == 8> t4;
sa<sizeof(sink_5_12378(source())) == 7> t5;
sa<sizeof(sink_5_12378(c_source())) == 8> t6;
sa<sizeof(sink_5_12378(v_source())) == 7> t7;
@@ -394,7 +391,6 @@ int test5_12567()
const volatile A cva = a;
sa<sizeof(sink_5_12567(a)) == 1> t1;
sa<sizeof(sink_5_12567(ca)) == 2> t2;
- sa<sizeof(sink_5_12567(va)) == 7> t3;
sa<sizeof(sink_5_12567(source())) == 5> t5;
sa<sizeof(sink_5_12567(c_source())) == 6> t6;
sa<sizeof(sink_5_12567(v_source())) == 7> t7;
@@ -415,8 +411,6 @@ int test5_12568()
const volatile A cva = a;
sa<sizeof(sink_5_12568(a)) == 1> t1;
sa<sizeof(sink_5_12568(ca)) == 2> t2;
- sa<sizeof(sink_5_12568(va)) == 8> t3;
- sa<sizeof(sink_5_12568(cva)) == 8> t4;
sa<sizeof(sink_5_12568(source())) == 5> t5;
sa<sizeof(sink_5_12568(c_source())) == 6> t6;
sa<sizeof(sink_5_12568(v_source())) == 8> t7;
@@ -438,8 +432,6 @@ int test5_12578()
const volatile A cva = a;
sa<sizeof(sink_5_12578(a)) == 1> t1;
sa<sizeof(sink_5_12578(ca)) == 2> t2;
- sa<sizeof(sink_5_12578(va)) == 7> t3;
- sa<sizeof(sink_5_12578(cva)) == 8> t4;
sa<sizeof(sink_5_12578(source())) == 5> t5;
sa<sizeof(sink_5_12578(c_source())) == 8> t6;
sa<sizeof(sink_5_12578(v_source())) == 7> t7;
@@ -461,8 +453,6 @@ int test5_12678()
const volatile A cva = a;
sa<sizeof(sink_5_12678(a)) == 1> t1;
sa<sizeof(sink_5_12678(ca)) == 2> t2;
- sa<sizeof(sink_5_12678(va)) == 7> t3;
- sa<sizeof(sink_5_12678(cva)) == 8> t4;
sa<sizeof(sink_5_12678(c_source())) == 6> t6;
sa<sizeof(sink_5_12678(v_source())) == 7> t7;
sa<sizeof(sink_5_12678(cv_source())) == 8> t8;
@@ -614,7 +604,6 @@ int test5_13567()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_5_13567(a)) == 1> t1;
- sa<sizeof(sink_5_13567(ca)) == 6> t2;
sa<sizeof(sink_5_13567(va)) == 3> t3;
sa<sizeof(sink_5_13567(source())) == 5> t5;
sa<sizeof(sink_5_13567(c_source())) == 6> t6;
@@ -635,9 +624,7 @@ int test5_13568()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_5_13568(a)) == 1> t1;
- sa<sizeof(sink_5_13568(ca)) == 6> t2;
sa<sizeof(sink_5_13568(va)) == 3> t3;
- sa<sizeof(sink_5_13568(cva)) == 8> t4;
sa<sizeof(sink_5_13568(source())) == 5> t5;
sa<sizeof(sink_5_13568(c_source())) == 6> t6;
sa<sizeof(sink_5_13568(v_source())) == 8> t7;
@@ -658,9 +645,7 @@ int test5_13578()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_5_13578(a)) == 1> t1;
- sa<sizeof(sink_5_13578(ca)) == 8> t2;
sa<sizeof(sink_5_13578(va)) == 3> t3;
- sa<sizeof(sink_5_13578(cva)) == 8> t4;
sa<sizeof(sink_5_13578(source())) == 5> t5;
sa<sizeof(sink_5_13578(c_source())) == 8> t6;
sa<sizeof(sink_5_13578(v_source())) == 7> t7;
@@ -681,9 +666,7 @@ int test5_13678()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_5_13678(a)) == 1> t1;
- sa<sizeof(sink_5_13678(ca)) == 6> t2;
sa<sizeof(sink_5_13678(va)) == 3> t3;
- sa<sizeof(sink_5_13678(cva)) == 8> t4;
sa<sizeof(sink_5_13678(c_source())) == 6> t6;
sa<sizeof(sink_5_13678(v_source())) == 7> t7;
sa<sizeof(sink_5_13678(cv_source())) == 8> t8;
@@ -793,9 +776,6 @@ int test5_15678()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_5_15678(a)) == 1> t1;
- sa<sizeof(sink_5_15678(ca)) == 6> t2;
- sa<sizeof(sink_5_15678(va)) == 7> t3;
- sa<sizeof(sink_5_15678(cva)) == 8> t4;
sa<sizeof(sink_5_15678(source())) == 5> t5;
sa<sizeof(sink_5_15678(c_source())) == 6> t6;
sa<sizeof(sink_5_15678(v_source())) == 7> t7;
@@ -964,7 +944,6 @@ int test5_23568()
const volatile A cva = a;
sa<sizeof(sink_5_23568(ca)) == 2> t2;
sa<sizeof(sink_5_23568(va)) == 3> t3;
- sa<sizeof(sink_5_23568(cva)) == 8> t4;
sa<sizeof(sink_5_23568(source())) == 5> t5;
sa<sizeof(sink_5_23568(c_source())) == 6> t6;
sa<sizeof(sink_5_23568(v_source())) == 8> t7;
@@ -986,7 +965,6 @@ int test5_23578()
const volatile A cva = a;
sa<sizeof(sink_5_23578(ca)) == 2> t2;
sa<sizeof(sink_5_23578(va)) == 3> t3;
- sa<sizeof(sink_5_23578(cva)) == 8> t4;
sa<sizeof(sink_5_23578(source())) == 5> t5;
sa<sizeof(sink_5_23578(c_source())) == 8> t6;
sa<sizeof(sink_5_23578(v_source())) == 7> t7;
@@ -1008,7 +986,6 @@ int test5_23678()
const volatile A cva = a;
sa<sizeof(sink_5_23678(ca)) == 2> t2;
sa<sizeof(sink_5_23678(va)) == 3> t3;
- sa<sizeof(sink_5_23678(cva)) == 8> t4;
sa<sizeof(sink_5_23678(c_source())) == 6> t6;
sa<sizeof(sink_5_23678(v_source())) == 7> t7;
sa<sizeof(sink_5_23678(cv_source())) == 8> t8;
@@ -1119,8 +1096,6 @@ int test5_25678()
const volatile A cva = a;
sa<sizeof(sink_5_25678(a)) == 2> t1;
sa<sizeof(sink_5_25678(ca)) == 2> t2;
- sa<sizeof(sink_5_25678(va)) == 7> t3;
- sa<sizeof(sink_5_25678(cva)) == 8> t4;
sa<sizeof(sink_5_25678(source())) == 5> t5;
sa<sizeof(sink_5_25678(c_source())) == 6> t6;
sa<sizeof(sink_5_25678(v_source())) == 7> t7;
@@ -1231,9 +1206,7 @@ int test5_35678()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_5_35678(a)) == 3> t1;
- sa<sizeof(sink_5_35678(ca)) == 6> t2;
sa<sizeof(sink_5_35678(va)) == 3> t3;
- sa<sizeof(sink_5_35678(cva)) == 8> t4;
sa<sizeof(sink_5_35678(source())) == 5> t5;
sa<sizeof(sink_5_35678(c_source())) == 6> t6;
sa<sizeof(sink_5_35678(v_source())) == 7> t7;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv6n.C b/gcc/testsuite/g++.dg/cpp0x/rv6n.C
index 040c0f6..2a2520c 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv6n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv6n.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -70,7 +70,7 @@ three sink_6_235678(volatile A&); // { dg-message "note" }
five sink_6_235678( A&&); // { dg-message "note" }
six sink_6_235678(const A&&); // { dg-message "note" }
seven sink_6_235678(volatile A&&); // { dg-message "note" }
-eight sink_6_235678(const volatile A&&); // { dg-message "note" }
+eight sink_6_235678(const volatile A&&); // { dg-message "" }
int test6_235678()
{
@@ -79,6 +79,7 @@ int test6_235678()
volatile A va;
const volatile A cva = a;
sink_6_235678(a); // { dg-error "ambiguous" }
+ sink_6_235678(cva); // { dg-error "lvalue" }
return 0;
}
@@ -191,7 +192,7 @@ two sink_6_123678(const A&); // { dg-message "candidates" }
three sink_6_123678(volatile A&);
six sink_6_123678(const A&&); // { dg-message "note" }
seven sink_6_123678(volatile A&&); // { dg-message "note" }
-eight sink_6_123678(const volatile A&&); // { dg-message "note" }
+eight sink_6_123678(const volatile A&&); // { dg-message "" }
int test6_123678()
{
@@ -199,6 +200,7 @@ int test6_123678()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_6_123678(cva); // { dg-error "lvalue" }
sink_6_123678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -221,6 +223,40 @@ int test6_123567()
return 0;
}
+one sink_6_123568( A&);
+two sink_6_123568(const A&);
+three sink_6_123568(volatile A&);
+five sink_6_123568( A&&);
+six sink_6_123568(const A&&);
+eight sink_6_123568(const volatile A&&); // { dg-message "" }
+
+int test6_123568()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_6_123568(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+one sink_6_123578( A&);
+two sink_6_123578(const A&);
+three sink_6_123578(volatile A&);
+five sink_6_123578( A&&);
+seven sink_6_123578(volatile A&&);
+eight sink_6_123578(const volatile A&&); // { dg-message "" }
+
+int test6_123578()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_6_123578(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_6_123467( A&); // { dg-message "candidates" }
two sink_6_123467(const A&); // { dg-message "note" }
three sink_6_123467(volatile A&); // { dg-message "note" }
@@ -256,6 +292,24 @@ int test6_124567()
return 0;
}
+one sink_6_125678( A&);
+two sink_6_125678(const A&);
+five sink_6_125678( A&&);
+six sink_6_125678(const A&&);
+seven sink_6_125678(volatile A&&); // { dg-message "" }
+eight sink_6_125678(const volatile A&&); // { dg-message "" }
+
+int test6_125678()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_6_125678(va); // { dg-error "lvalue" }
+ sink_6_125678(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_6_134567( A&); // { dg-message "candidates" }
three sink_6_134567(volatile A&); // { dg-message "note" }
four sink_6_134567(const volatile A&); // { dg-message "note" }
@@ -273,6 +327,24 @@ int test6_134567()
return 0;
}
+one sink_6_135678( A&);
+three sink_6_135678(volatile A&);
+five sink_6_135678( A&&);
+six sink_6_135678(const A&&); // { dg-message "" }
+seven sink_6_135678(volatile A&&);
+eight sink_6_135678(const volatile A&&); // { dg-message "" }
+
+int test6_135678()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_6_135678(ca); // { dg-error "lvalue" }
+ sink_6_135678(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
int main()
{
return test6_235678() + test6_234678() + test6_234578() + test6_234568() +
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv6p.C b/gcc/testsuite/g++.dg/cpp0x/rv6p.C
index a59958e..0e5352b 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv6p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv6p.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -207,7 +207,6 @@ int test6_123568()
sa<sizeof(sink_6_123568(a)) == 1> t1;
sa<sizeof(sink_6_123568(ca)) == 2> t2;
sa<sizeof(sink_6_123568(va)) == 3> t3;
- sa<sizeof(sink_6_123568(cva)) == 8> t4;
sa<sizeof(sink_6_123568(source())) == 5> t5;
sa<sizeof(sink_6_123568(c_source())) == 6> t6;
sa<sizeof(sink_6_123568(v_source())) == 8> t7;
@@ -231,7 +230,6 @@ int test6_123578()
sa<sizeof(sink_6_123578(a)) == 1> t1;
sa<sizeof(sink_6_123578(ca)) == 2> t2;
sa<sizeof(sink_6_123578(va)) == 3> t3;
- sa<sizeof(sink_6_123578(cva)) == 8> t4;
sa<sizeof(sink_6_123578(source())) == 5> t5;
sa<sizeof(sink_6_123578(c_source())) == 8> t6;
sa<sizeof(sink_6_123578(v_source())) == 7> t7;
@@ -255,7 +253,6 @@ int test6_123678()
sa<sizeof(sink_6_123678(a)) == 1> t1;
sa<sizeof(sink_6_123678(ca)) == 2> t2;
sa<sizeof(sink_6_123678(va)) == 3> t3;
- sa<sizeof(sink_6_123678(cva)) == 8> t4;
sa<sizeof(sink_6_123678(c_source())) == 6> t6;
sa<sizeof(sink_6_123678(v_source())) == 7> t7;
sa<sizeof(sink_6_123678(cv_source())) == 8> t8;
@@ -371,8 +368,6 @@ int test6_125678()
const volatile A cva = a;
sa<sizeof(sink_6_125678(a)) == 1> t1;
sa<sizeof(sink_6_125678(ca)) == 2> t2;
- sa<sizeof(sink_6_125678(va)) == 7> t3;
- sa<sizeof(sink_6_125678(cva)) == 8> t4;
sa<sizeof(sink_6_125678(source())) == 5> t5;
sa<sizeof(sink_6_125678(c_source())) == 6> t6;
sa<sizeof(sink_6_125678(v_source())) == 7> t7;
@@ -488,9 +483,7 @@ int test6_135678()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_6_135678(a)) == 1> t1;
- sa<sizeof(sink_6_135678(ca)) == 6> t2;
sa<sizeof(sink_6_135678(va)) == 3> t3;
- sa<sizeof(sink_6_135678(cva)) == 8> t4;
sa<sizeof(sink_6_135678(source())) == 5> t5;
sa<sizeof(sink_6_135678(c_source())) == 6> t6;
sa<sizeof(sink_6_135678(v_source())) == 7> t7;
@@ -627,7 +620,6 @@ int test6_235678()
const volatile A cva = a;
sa<sizeof(sink_6_235678(ca)) == 2> t2;
sa<sizeof(sink_6_235678(va)) == 3> t3;
- sa<sizeof(sink_6_235678(cva)) == 8> t4;
sa<sizeof(sink_6_235678(source())) == 5> t5;
sa<sizeof(sink_6_235678(c_source())) == 6> t6;
sa<sizeof(sink_6_235678(v_source())) == 7> t7;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv7n.C b/gcc/testsuite/g++.dg/cpp0x/rv7n.C
index 9d81bd5..102730b 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv7n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv7n.C
@@ -48,6 +48,24 @@ int test7_1234567()
return 0;
}
+one sink_7_1235678( A&);
+two sink_7_1235678(const A&);
+three sink_7_1235678(volatile A&);
+five sink_7_1235678( A&&);
+six sink_7_1235678(const A&&);
+seven sink_7_1235678(volatile A&&);
+eight sink_7_1235678(const volatile A&&); // { dg-message "" }
+
+int test7_1235678()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_7_1235678(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
two sink_7_2345678(const A&); // { dg-message "candidates" }
three sink_7_2345678(volatile A&); // { dg-message "note" }
four sink_7_2345678(const volatile A&); // { dg-message "note" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv7p.C b/gcc/testsuite/g++.dg/cpp0x/rv7p.C
index d3e1474..d25488f 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv7p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv7p.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -145,7 +145,6 @@ int test7_1235678()
sa<sizeof(sink_7_1235678(a)) == 1> t1;
sa<sizeof(sink_7_1235678(ca)) == 2> t2;
sa<sizeof(sink_7_1235678(va)) == 3> t3;
- sa<sizeof(sink_7_1235678(cva)) == 8> t4;
sa<sizeof(sink_7_1235678(source())) == 5> t5;
sa<sizeof(sink_7_1235678(c_source())) == 6> t6;
sa<sizeof(sink_7_1235678(v_source())) == 7> t7;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv8p.C b/gcc/testsuite/g++.dg/cpp0x/rv8p.C
index 95a72d5..cc7ff8a 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv8p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv8p.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/template_deduction.C b/gcc/testsuite/g++.dg/cpp0x/template_deduction.C
index ee48fb3..c1eace6 100644
--- a/gcc/testsuite/g++.dg/cpp0x/template_deduction.C
+++ b/gcc/testsuite/g++.dg/cpp0x/template_deduction.C
@@ -35,7 +35,7 @@ test1(T&&)
template <bool is_lvalue_ref, bool is_rvalue_ref, class T>
void
-test2(const T&&)
+test2(const T&&) // { dg-error "argument" }
{
sa<is_lvalue_reference<const T&&>::value == is_lvalue_ref> t1;
sa<is_rvalue_reference<const T&&>::value == is_rvalue_ref> t2;
@@ -60,7 +60,7 @@ int main()
{
test1<true, false>(a);
test1<false, true>(source());
- test2<false, true>(a);
+ test2<false, true>(a); // { dg-error "lvalue" }
test2<false, true>(source());
test3<false, true>(&a);
test3<false, true>(sourcep());
diff --git a/gcc/testsuite/g++.dg/cpp0x/unnamed_refs.C b/gcc/testsuite/g++.dg/cpp0x/unnamed_refs.C
index 0631185..57d6359 100644
--- a/gcc/testsuite/g++.dg/cpp0x/unnamed_refs.C
+++ b/gcc/testsuite/g++.dg/cpp0x/unnamed_refs.C
@@ -16,7 +16,12 @@ struct A {};
one foo(const A&) {return one();}
two foo(A&&) {return two();}
-A&& source() {static A a; return a;}
+template<typename _Tp>
+inline _Tp&&
+movel(_Tp& __t)
+{ return static_cast<_Tp&&>(__t); }
+
+A&& source() {static A a; return movel(a);}
int test1()
{