diff options
author | Jason Merrill <jason@redhat.com> | 2011-02-21 00:25:56 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-02-21 00:25:56 -0500 |
commit | c62f4cd9cf70644b7708f5f4eedbfff4c5aa48e2 (patch) | |
tree | e7448591e02fe6326bc0006c86df5145e9c00882 | |
parent | a3dbf764ae79f617b1710dbffd7698057d98c5f9 (diff) | |
download | gcc-c62f4cd9cf70644b7708f5f4eedbfff4c5aa48e2.zip gcc-c62f4cd9cf70644b7708f5f4eedbfff4c5aa48e2.tar.gz gcc-c62f4cd9cf70644b7708f5f4eedbfff4c5aa48e2.tar.bz2 |
re PR c++/47199 ([C++0x] ICE: expected class 'type', have 'declaration' (function_decl) in same_type_ignoring_top_level_qualifiers_p, at cp/typeck.c:1407 with -fno-elide-constructors)
PR c++/47199
* semantics.c (cxx_eval_call_expression): Call
cxx_eval_constant_expression in trivial shortcut.
From-SVN: r170356
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-ctor7.C | 17 |
4 files changed, 28 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4ce3f27..9fde00c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 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. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 8944690..b7ed525 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -6021,7 +6021,11 @@ cxx_eval_call_expression (const constexpr_call *old_call, tree t, /* 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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index db45d88..77b0bef 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 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. diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor7.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor7.C new file mode 100644 index 0000000..8338bf1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ctor7.C @@ -0,0 +1,17 @@ +// 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; |