diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc index 33e9411f10c..9375a116f06 100644 --- a/gcc/cp/cp-gimplify.cc +++ b/gcc/cp/cp-gimplify.cc @@ -1132,7 +1132,14 @@ cp_fold_immediate (tree *tp, mce_value manifestly_const_eval) Note: The folding of non-omp cases is something to move into the middle-end. As for now we have most foldings only on GENERIC in fold-const, we need to perform this before transformation to - GIMPLE-form. */ + GIMPLE-form. + + ??? This is algorithmically weird because walk_tree works in pre-order, so + we see outer expressions before inner expressions. This isn't as much of an + issue because cp_fold recurses into subexpressions in many cases, but then + walk_tree walks back into those subexpressions again. We avoid the + resulting complexity problem by caching the result of cp_fold, but it's + inelegant. */ static tree cp_fold_r (tree *stmt_p, int *walk_subtrees, void *data_) diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def index d78005e50b9..bf3bcd1bf13 100644 --- a/gcc/cp/cp-tree.def +++ b/gcc/cp/cp-tree.def @@ -24,13 +24,14 @@ along with GCC; see the file COPYING3. If not see /* An OFFSET_REF is used in two situations: 1. An expression of the form `A::m' where `A' is a class and `m' is - a non-static member. In this case, operand 0 will be a TYPE - (corresponding to `A') and operand 1 will be a FIELD_DECL, - BASELINK, or TEMPLATE_ID_EXPR (corresponding to `m'). + a non-static member or an overload set. In this case, operand 0 + will be a TYPE (corresponding to `A') and operand 1 will be a + FIELD_DECL, BASELINK, or TEMPLATE_ID_EXPR (corresponding to `m'). - The expression is a pointer-to-member if its address is taken, - but simply denotes a member of the object if its address is not - taken. + The expression is a pointer-to-member if its address is taken (and + if, after any overload resolution, 'm' does not designate a + static or explicit object member function). It simply denotes a + member of the object if its address is not taken. This form is only used during the parsing phase; once semantic analysis has taken place they are eliminated.