From 3f3fd87d46ec45a4894ae9390424bf7663f771e4 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 18 Sep 2013 18:11:46 +0000 Subject: [PATCH] re PR c++/58457 (ICE when placement new operator is used with using keyword and custom constructor) /cp 2013-09-18 Paolo Carlini PR c++/58457 * class.c (instantiate_type): Loosen a bit the gcc_assert. /testsuite 2013-09-18 Paolo Carlini PR c++/58457 * g++.dg/parse/using4.C: New. From-SVN: r202711 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/class.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/parse/using4.C | 20 ++++++++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/parse/using4.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d53fb51198b..5ee1f9173b0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2013-09-18 Paolo Carlini + + PR c++/58457 + * class.c (instantiate_type): Loosen a bit the gcc_assert. + 2013-09-18 Marek Polacek PR sanitize/58443 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 3d34b92cfb1..9e0229fcba3 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -7627,7 +7627,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags) dependent on overload resolution. */ gcc_assert (TREE_CODE (rhs) == ADDR_EXPR || TREE_CODE (rhs) == COMPONENT_REF - || really_overloaded_fn (rhs) + || is_overloaded_fn (rhs) || (flag_ms_extensions && TREE_CODE (rhs) == FUNCTION_DECL)); /* This should really only be used when attempting to distinguish diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 348691e0b36..60c0baa719b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-09-18 Paolo Carlini + + PR c++/58457 + * g++.dg/parse/using4.C: New. + 2013-09-18 Kyrylo Tkachov * gcc.c-torture/execute/pr58419.c (b): Change type to signed char. diff --git a/gcc/testsuite/g++.dg/parse/using4.C b/gcc/testsuite/g++.dg/parse/using4.C new file mode 100644 index 00000000000..2abe399f8dc --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/using4.C @@ -0,0 +1,20 @@ +// PR c++/58457 + +struct allocator +{ + void operator delete (void*); + void* operator new (__SIZE_TYPE__, void*); +}; + +struct type : public allocator +{ + type() {} + using allocator::operator new; + using allocator::operator delete; +}; + +int main() +{ + new (0) type; + return 0; +} -- 2.30.2