aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/constexpr.c2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-pmf2.C9
2 files changed, 10 insertions, 1 deletions
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 4a5e638..9dddc53 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -2790,7 +2790,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
/* Rewrite all occurrences of the function's RESULT_DECL with the
current object under construction. */
if (!*non_constant_p && ctx->object
- && AGGREGATE_TYPE_P (TREE_TYPE (res))
+ && CLASS_TYPE_P (TREE_TYPE (res))
&& !is_empty_class (TREE_TYPE (res)))
if (replace_result_decl (&result, res, ctx->object))
cacheable = false;
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-pmf2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-pmf2.C
new file mode 100644
index 0000000..a76e712
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-pmf2.C
@@ -0,0 +1,9 @@
+// PR c++/98551
+// { dg-do compile { target c++11 } }
+
+struct A {};
+struct B { int t(); };
+using pmf = decltype(&B::t);
+constexpr pmf f() { return &B::t; }
+constexpr A g(pmf) { return {}; };
+constexpr A x = g(f());