diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2002-09-16 15:15:36 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2002-09-16 15:15:36 +0000 |
commit | 7979434d1d6ba9537a8e8931b36c50fd43295d6e (patch) | |
tree | 050634ddd7cd580107f24f5b1cfabd838623c20b /gcc | |
parent | 28c56d256992d5d330ebec07b1e939924b8d1086 (diff) | |
download | gcc-7979434d1d6ba9537a8e8931b36c50fd43295d6e.zip gcc-7979434d1d6ba9537a8e8931b36c50fd43295d6e.tar.gz gcc-7979434d1d6ba9537a8e8931b36c50fd43295d6e.tar.bz2 |
parse.y (parse_finish_call_expr): Check lookup_member result.
cp:
* parse.y (parse_finish_call_expr): Check lookup_member result.
testsuite:
* g++.dg/lookup/scoped2.C: New test.
From-SVN: r57195
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/cp/parse.y | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/scoped2.C | 19 |
4 files changed, 29 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3c3fb93..a4ddb5a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,7 @@ 2002-09-16 Nathan Sidwell <nathan@codesourcery.com> + * parse.y (parse_finish_call_expr): Check lookup_member result. + PR c++/7015 * semantic.c (finish_asm_stmt): Fix operand/output_operands thinko. diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 8fe244e..8cce99b 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -4177,6 +4177,12 @@ parse_finish_call_expr (tree fn, tree args, int koenig) name = DECL_NAME (get_first_fn (name)); fn = lookup_member (scope, name, /*protect=*/1, /*prefer_type=*/0); + if (!fn) + { + error ("'%D' has no member named '%E'", scope, name); + return error_mark_node; + } + if (BASELINK_P (fn) && template_id) BASELINK_FUNCTIONS (fn) = build_nt (TEMPLATE_ID_EXPR, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 603b39d..2d65752 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2002-09-16 Nathan Sidwell <nathan@codesourcery.com> + * g++.dg/lookup/scoped2.C: New test. + * g++.dg/ext/asm3.C: New test. 2002-09-16 Richard Earnshaw <rearnsha@arm.com> diff --git a/gcc/testsuite/g++.dg/lookup/scoped2.C b/gcc/testsuite/g++.dg/lookup/scoped2.C new file mode 100644 index 0000000..80cfb1f --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/scoped2.C @@ -0,0 +1,19 @@ +// { dg-do compile } + +// Copyright (C) 2002 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 16 Sep 2002 <nathan@codesourcery.com> + +// Seg faulted. + +struct Base +{ +}; + +struct Derived : Base +{ + void Foo () + { + Base::Baz (); // { dg-error "has no member" "" } + + }; +}; |