From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 873 invoked by alias); 10 Sep 2010 19:02:05 -0000 Received: (qmail 862 invoked by uid 22791); 10 Sep 2010 19:02:04 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 10 Sep 2010 19:02:00 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8AJ1w3E004858 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 10 Sep 2010 15:01:58 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o8AJ1vLa003962 for ; Fri, 10 Sep 2010 15:01:58 -0400 Received: from [10.15.16.129] (dhcp-10-15-16-129.yyz.redhat.com [10.15.16.129]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o8AJ1vll005429 for ; Fri, 10 Sep 2010 15:01:57 -0400 Message-ID: <4C8A80A4.9060707@redhat.com> Date: Fri, 10 Sep 2010 20:30:00 -0000 From: sami wagiaalla User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Lightning/1.0b2pre Thunderbird/3.1.2 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [patch] PR 11992 "Regression: C++ this scope sometimes does not work" Content-Type: multipart/mixed; boundary="------------080105020906050903050808" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-09/txt/msg00232.txt.bz2 This is a multi-part message in MIME format. --------------080105020906050903050808 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 131 This is a fix and a test case for the above mentioned bug. The patch was regression testing on F13 on x8664 with gcc 4.4.4. Sami --------------080105020906050903050808 Content-Type: text/x-patch; name="this_regression.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="this_regression.patch" Content-length: 1957 Fix PR 11992: C++ 'this' scope sometimes does not work 2010-09-10 Sami Wagiaalla PR symtab/11992: * c-exp.y (classify_name): Check is_a_member_of_this before returning UNKNOWN_CPP_NAME. 2010-09-10 Sami Wagiaalla * gdb.cp/koenig.cc: created class for testing member lookup. * gdb.cp/koenig.exp: Added test for member lookup. diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 663e778..57e09b3 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -2389,6 +2389,7 @@ classify_name (struct block *block) if (sym == NULL && parse_language->la_language == language_cplus + && !is_a_field_of_this && !lookup_minimal_symbol (copy, NULL, NULL)) return UNKNOWN_CPP_NAME; diff --git a/gdb/testsuite/gdb.cp/koenig.cc b/gdb/testsuite/gdb.cp/koenig.cc index c91dbf9..d5e7bbe 100644 --- a/gdb/testsuite/gdb.cp/koenig.cc +++ b/gdb/testsuite/gdb.cp/koenig.cc @@ -226,6 +226,16 @@ namespace P { //------------ +class R { + public: + int foo(){ return 31; } + int bar(){ + return foo()+1; // marker1 + } +}; + +//------------ + int main () { @@ -299,6 +309,9 @@ main () ++q; + R r; + r.bar(); + return first (0, c) + foo (eo) + foo (eo, eo) + foo (eo, eo, 1) + foo (fo, eo) + foo (1 ,fo, eo) + diff --git a/gdb/testsuite/gdb.cp/koenig.exp b/gdb/testsuite/gdb.cp/koenig.exp index d5e6c3f..d291a6e 100644 --- a/gdb/testsuite/gdb.cp/koenig.exp +++ b/gdb/testsuite/gdb.cp/koenig.exp @@ -115,3 +115,14 @@ gdb_test "p q + 5" "= 29" # some unary operators for good measure # Cannot resolve function operator++ to any overloaded instance gdb_test "p ++q" "= 30" + +# test that koening lookup does not effect +# member variable lookup +gdb_test "p r.foo()" "= 31" + +# Do the same from inside class R +gdb_breakpoint [gdb_get_line_number "marker1"] +gdb_continue_to_breakpoint "marker1" + +gdb_test "p foo()" "= 31" +gdb_test "p this->foo()" "= 31" --------------080105020906050903050808--