2011-02-20 Jason Merrill <jason@redhat.com>
+ PR c++/47199
+ * semantics.c (cxx_eval_call_expression): Call
+ cxx_eval_constant_expression in trivial shortcut.
+
PR c++/46831
* call.c (convert_class_to_reference): Don't try to set up a
second conv sequence for non-viable candidates.
/* Shortcut trivial copy constructor/op=. */
if (call_expr_nargs (t) == 2 && trivial_fn_p (fun))
- return convert_from_reference (get_nth_callarg (t, 1));
+ {
+ tree arg = convert_from_reference (get_nth_callarg (t, 1));
+ return cxx_eval_constant_expression (old_call, arg, allow_non_constant,
+ addr, non_constant_p);
+ }
/* If in direct recursive call, optimize definition search. */
if (old_call != NULL && old_call->fundef->decl == fun)
2011-02-20 Jason Merrill <jason@redhat.com>
+ * g++.dg/cpp0x/constexpr-ctor7.C: New.
+
* g++.dg/cpp0x/fntmpdefarg2.C: New.
* g++.dg/overload/conv-op1.C: New.
--- /dev/null
+// PR c++/47199
+// { dg-options "-std=c++0x -fno-elide-constructors" }
+
+template < int > struct S
+{
+ constexpr S (int r):rr (r)
+ {
+ }
+ S (const S &) = default;
+ static constexpr S s ()
+ {
+ return -1;
+ }
+ int rr;
+};
+
+static const int d = S < 0 >::s ().rr;