diff options
author | Jason Merrill <jason@gcc.gnu.org> | 1998-11-24 12:56:27 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-11-24 12:56:27 -0500 |
commit | 333a9f0aafc0d0e426d948e545daae6f6d277f19 (patch) | |
tree | 591228b90f61a6dc82273adf8622872b83422762 /gcc | |
parent | 818347b4d66fa9f9af05751b5880f54830cc4c2e (diff) | |
download | gcc-333a9f0aafc0d0e426d948e545daae6f6d277f19.zip gcc-333a9f0aafc0d0e426d948e545daae6f6d277f19.tar.gz gcc-333a9f0aafc0d0e426d948e545daae6f6d277f19.tar.bz2 |
typeck.c (build_component_ref): Remove unused statement.
* typeck.c (build_component_ref): Remove unused statement.
* class.c (add_method): Catch invalid overloads.
Fixes Sec13/1/E13097.C.
From-SVN: r23833
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/class.c | 20 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 5 |
3 files changed, 27 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 92fed97..07ebc11 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ +1998-11-24 Graham <grahams@rcp.co.uk> + + * typeck.c (build_component_ref): Remove unused statement. + 1998-11-24 Jason Merrill <jason@yorick.cygnus.com> + * class.c (add_method): Catch invalid overloads. + * class.c (add_method): Build up OVERLOADs properly for conversion ops. * search.c (lookup_conversions): Handle getting real OVERLOADs. (add_conversions): Likewise. Revert last change. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index de283ea..8c098f0 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1208,6 +1208,26 @@ add_method (type, fields, method) if (TREE_CODE (method) != TEMPLATE_DECL) { + /* [over.load] Member function declarations with the + same name and the same parameter types cannot be + overloaded if any of them is a static member + function declaration. */ + if (DECL_STATIC_FUNCTION_P (fn) + != DECL_STATIC_FUNCTION_P (method)) + { + tree parms1 = TYPE_ARG_TYPES (TREE_TYPE (fn)); + tree parms2 = TYPE_ARG_TYPES (TREE_TYPE (method)); + + if (! DECL_STATIC_FUNCTION_P (fn)) + parms1 = TREE_CHAIN (parms1); + else + parms2 = TREE_CHAIN (parms2); + + if (compparms (parms1, parms2)) + cp_error ("`%#D' and `%#D' cannot be overloaded", + fn, method); + } + /* Since this is an ordinary function in a non-template class, it's mangled name can be used as a unique identifier. This technique diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index e944eee..18160be 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2059,10 +2059,7 @@ build_component_ref (datum, component, basetype_path, protect) && TREE_CODE (TREE_VALUE (fndecls)) == FUNCTION_DECL && DECL_STATIC_FUNCTION_P (TREE_VALUE (fndecls))) { - tree fndecl; - - basetype = TYPE_MAIN_VARIANT (TREE_PURPOSE (fndecls)); - fndecl = TREE_VALUE (fndecls); + tree fndecl = TREE_VALUE (fndecls); enforce_access (TREE_PURPOSE (fndecls), fndecl); mark_used (fndecl); return fndecl; |