mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-25 01:11:10 +08:00
re PR c++/65202 (ICE segfault with constexpr/noexcept)
PR c++/65202 * constexpr.c (cxx_eval_constant_expression): Don't evaluate a RETURN_EXPR if its operand is null. * g++.dg/cpp1y/pr65202.C: New test. From-SVN: r221015
This commit is contained in:
parent
491080f4c1
commit
75e0295b00
gcc
@ -1,3 +1,9 @@
|
||||
2015-02-26 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c++/65202
|
||||
* constexpr.c (cxx_eval_constant_expression): Don't evaluate
|
||||
a RETURN_EXPR if its operand is null.
|
||||
|
||||
2015-02-25 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/65209
|
||||
|
@ -3113,9 +3113,10 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
|
||||
break;
|
||||
|
||||
case RETURN_EXPR:
|
||||
r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0),
|
||||
lval,
|
||||
non_constant_p, overflow_p);
|
||||
if (TREE_OPERAND (t, 0) != NULL_TREE)
|
||||
r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0),
|
||||
lval,
|
||||
non_constant_p, overflow_p);
|
||||
*jump_target = t;
|
||||
break;
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2015-02-26 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c++/65202
|
||||
* g++.dg/cpp1y/pr65202.C: New test.
|
||||
|
||||
2015-02-26 Tom de Vries <tom@codesourcery.com>
|
||||
|
||||
* g++.dg/gcov/gcov-14.C: Add cleanup of iostream.gcov, ostream.gcov and
|
||||
|
26
gcc/testsuite/g++.dg/cpp1y/pr65202.C
Normal file
26
gcc/testsuite/g++.dg/cpp1y/pr65202.C
Normal file
@ -0,0 +1,26 @@
|
||||
// // PR c++/65202
|
||||
// { dg-do compile { target c++14 } }
|
||||
|
||||
template <typename T> struct is_move_constructible;
|
||||
template <typename T> struct is_move_assignable;
|
||||
template <int, typename T> using enable_if_t = int;
|
||||
namespace adl {
|
||||
template <
|
||||
typename L, typename R,
|
||||
enable_if_t<is_move_constructible<L>() && is_move_assignable<L>(), int>...>
|
||||
constexpr auto adl_swap(L &l, R &r) -> decltype(swap(l, r)) {
|
||||
return;
|
||||
}
|
||||
template <typename L, typename R>
|
||||
auto swap(L &l, R &r) noexcept(noexcept(adl::adl_swap(l, r)))
|
||||
-> decltype(adl::adl_swap(l, r));
|
||||
namespace ns {
|
||||
template <typename T> struct foo {};
|
||||
template <typename T> void swap(foo<T> &, foo<T> &);
|
||||
struct bar;
|
||||
|
||||
int main()
|
||||
{
|
||||
foo<ns::bar> f;
|
||||
adl::swap(f, f)
|
||||
} // { dg-error "" }
|
Loading…
x
Reference in New Issue
Block a user