* expr.c (mark_use): Use error_operand_p.
* typeck2.c (build_m_component_ref): Check error_operand_p after
calling mark_[lr]value_use.
* g++.dg/cpp1y/pr91845.C: New test.
From-SVN: r276102
+2019-09-24 Marek Polacek <polacek@redhat.com>
+
+ PR c++/91845 - ICE with invalid pointer-to-member.
+ * expr.c (mark_use): Use error_operand_p.
+ * typeck2.c (build_m_component_ref): Check error_operand_p after
+ calling mark_[lr]value_use.
+
2019-09-23 Paolo Carlini <paolo.carlini@oracle.com>
* pt.c (check_explicit_specialization): Use cp_expr_loc_or_input_loc.
{
#define RECUR(t) mark_use ((t), rvalue_p, read_p, loc, reject_builtin)
- if (expr == NULL_TREE || expr == error_mark_node)
+ if (expr == NULL_TREE || error_operand_p (expr))
return expr;
if (reject_builtin && reject_gcc_builtin (expr, loc))
tree binfo;
tree ctype;
- if (error_operand_p (datum) || error_operand_p (component))
- return error_mark_node;
-
datum = mark_lvalue_use (datum);
component = mark_rvalue_use (component);
+ if (error_operand_p (datum) || error_operand_p (component))
+ return error_mark_node;
+
ptrmem_type = TREE_TYPE (component);
if (!TYPE_PTRMEM_P (ptrmem_type))
{
+2019-09-24 Marek Polacek <polacek@redhat.com>
+
+ PR c++/91845 - ICE with invalid pointer-to-member.
+ * g++.dg/cpp1y/pr91845.C: New test.
+
2019-09-24 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* gcc.target/aarch64/nosplit-di-const-volatile_1.c: New test.
--- /dev/null
+// PR c++/91845 - ICE with invalid pointer-to-member.
+// { dg-do compile { target c++14 } }
+
+void non_const_mem_ptr() {
+ struct A {
+ };
+ constexpr A a = {1, 2}; // { dg-error "too many initializers" }
+ struct B {
+ int A::*p;
+ constexpr int g() const {
+ return a.*p; // { dg-error "use of local variable" }
+ };
+ };
+}