From: Mark Mitchell Date: Sun, 16 May 1999 23:46:40 +0000 (+0000) Subject: decl2.c (build_expr_from_tree): Handle COMPONENT_REFs that indicate a reference to... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=74322f31ce1569e43d0e9a8050cc151ab810d22e;p=gcc.git decl2.c (build_expr_from_tree): Handle COMPONENT_REFs that indicate a reference to a field that is a qualified name. * decl2.c (build_expr_from_tree): Handle COMPONENT_REFs that indicate a reference to a field that is a qualified name. From-SVN: r26956 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6f1ac55818a..51479528fd9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +1999-05-16 Mark Mitchell + + * decl2.c (build_expr_from_tree): Handle COMPONENT_REFs that + indicate a reference to a field that is a qualified name. + 1999-05-16 Jason Merrill * decl2.c (finish_objects): Don't use .?tors.* if we don't have diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 6a7e14f7a25..bb24014d790 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -4056,10 +4056,22 @@ build_expr_from_tree (t) } case COMPONENT_REF: - return build_x_component_ref - (build_expr_from_tree (TREE_OPERAND (t, 0)), - TREE_OPERAND (t, 1), NULL_TREE, 1); - + { + tree object = build_expr_from_tree (TREE_OPERAND (t, 0)); + tree field = TREE_OPERAND (t, 1); + + /* We use a COMPONENT_REF to indicate things of the form `x.b' + and `x.A::b'. We must distinguish between those cases + here. */ + if (TREE_CODE (field) == SCOPE_REF) + return build_object_ref (object, + TREE_OPERAND (field, 0), + TREE_OPERAND (field, 1)); + else + return build_x_component_ref (object, field, + NULL_TREE, 1); + } + case THROW_EXPR: return build_throw (build_expr_from_tree (TREE_OPERAND (t, 0))); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/lookup9.C b/gcc/testsuite/g++.old-deja/g++.pt/lookup9.C new file mode 100644 index 00000000000..d81ffb63a96 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/lookup9.C @@ -0,0 +1,16 @@ +// Build don't link: +// Origin: "Artem Hodyush" + +struct B { int m; }; + +template< class T > +void +q( T& t ) { + t.T::m=1; +} + +void f() { + B b; + b.B::m=1; + q( b ); +}