re PR c++/50034 (Overload selection failure within class template)
authorJason Merrill <jason@redhat.com>
Fri, 12 Aug 2011 21:27:52 +0000 (17:27 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 12 Aug 2011 21:27:52 +0000 (17:27 -0400)
PR c++/50034
* call.c (convert_arg_to_ellipsis): force_rvalue only in
potentially evaluated context.

From-SVN: r177722

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/defaulted28.C

index 47d636e..bb6d614 100644 (file)
@@ -1,3 +1,9 @@
+2011-08-12  Jason Merrill  <jason@redhat.com>
+
+       PR c++/50034
+       * call.c (convert_arg_to_ellipsis): force_rvalue only in
+       potentially evaluated context.
+
 2011-08-12  Richard Guenther  <rguenther@suse.de>
 
        * call.c (build_over_call): Instead of memcpy use an
index a3b0f8a..e8fb68d 100644 (file)
@@ -6097,7 +6097,7 @@ convert_arg_to_ellipsis (tree arg)
     {
       /* Build up a real lvalue-to-rvalue conversion in case the
         copy constructor is trivial but not callable.  */
-      if (CLASS_TYPE_P (arg_type))
+      if (!cp_unevaluated_operand && CLASS_TYPE_P (arg_type))
        force_rvalue (arg, tf_warning_or_error);
 
       /* [expr.call] 5.2.2/7:
index 38079fa..4cede20 100644 (file)
@@ -1,3 +1,8 @@
+2011-08-12  Jason Merrill  <jason@redhat.com>
+
+       PR c++/50034
+       * g++.dg/cpp0x/defaulted28.C: Add unevaluated case.
+
 2011-08-12  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.dg/builtins-67.c: New test.
index 15caef6..bcbf763 100644 (file)
@@ -1,4 +1,5 @@
 // PR c++/49102
+// PR c++/50034
 // { dg-options -std=c++0x }
 
 struct A {
@@ -8,8 +9,9 @@ private:
   A(A const&) = default;       // { dg-error "private" }
 };
 
-void f(...) { }
+int f(...) { }
 int main() {
   A a;
   f(a);                        // { dg-error "this context" }
+  sizeof(f(a));                        // OK because unevaluated
 }