From: Jason Merrill Date: Wed, 8 Oct 1997 06:04:28 +0000 (-0400) Subject: [multiple changes] X-Git-Tag: releases/egcs-1.0.0~364 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ffb690bd0862a35dd74a4abdc9c261ad7611a457;p=thirdparty%2Fgcc.git [multiple changes] Tue Oct 7 23:00:12 1997 Mark Mitchell * decl.c (make_typename_type): Do not try to call lookup_field for non-aggregate types. Tue Oct 7 22:52:10 1997 Jason Merrill * typeck.c (build_reinterpret_cast): Tweak. Tue Oct 7 22:45:31 1997 Alexandre Oliva * typeck.c (build_reinterpret_cast): converting a void pointer to function pointer with a reinterpret_cast produces a warning if -pedantic is issued Tue Oct 7 22:43:43 1997 Bruno Haible * typeck.c (c_expand_return): Don't warn about returning a reference-type variable as a reference. From-SVN: r15876 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 712e118500e9..b3d17955340f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,23 @@ +Tue Oct 7 23:00:12 1997 Mark Mitchell + + * decl.c (make_typename_type): Do not try to call lookup_field for + non-aggregate types. + +Tue Oct 7 22:52:10 1997 Jason Merrill + + * typeck.c (build_reinterpret_cast): Tweak. + +Tue Oct 7 22:45:31 1997 Alexandre Oliva + + * typeck.c (build_reinterpret_cast): converting a void pointer + to function pointer with a reinterpret_cast produces a warning + if -pedantic is issued + +Tue Oct 7 22:43:43 1997 Bruno Haible + + * typeck.c (c_expand_return): Don't warn about returning a + reference-type variable as a reference. + Tue Oct 7 21:11:22 1997 Jason Merrill * method.c (build_static_name): Fix typo. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 4f6f982237b8..9c8967068752 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4349,7 +4349,11 @@ make_typename_type (context, name) if (! uses_template_parms (context) || context == current_class_type) { - t = lookup_field (context, name, 0, 1); + if (IS_AGGR_TYPE (context)) + t = lookup_field (context, name, 0, 1); + else + t = NULL_TREE; + if (t == NULL_TREE) { cp_error ("no type named `%#T' in `%#T'", name, context); diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 797cd3d4c3e5..96d1c26e3e86 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -5380,6 +5380,14 @@ build_reinterpret_cast (type, expr) expr = decl_constant_value (expr); return fold (build1 (NOP_EXPR, type, expr)); } + else if ((TYPE_PTRFN_P (type) && TYPE_PTROBV_P (intype)) + || (TYPE_PTRFN_P (type) && TYPE_PTROBV_P (intype))) + { + pedwarn ("ANSI C++ forbids casting between pointers to functions and objects"); + if (TREE_READONLY_DECL_P (expr)) + expr = decl_constant_value (expr); + return fold (build1 (NOP_EXPR, type, expr)); + } else { cp_error ("reinterpret_cast from `%T' to `%T'", intype, type); @@ -7298,7 +7306,8 @@ c_expand_return (retval) { if (TEMP_NAME_P (DECL_NAME (whats_returned))) warning ("reference to non-lvalue returned"); - else if (! TREE_STATIC (whats_returned) + else if (TREE_CODE (TREE_TYPE (whats_returned)) != REFERENCE_TYPE + && ! TREE_STATIC (whats_returned) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (whats_returned)) && !TREE_PUBLIC (whats_returned)) cp_warning_at ("reference to local variable `%D' returned", whats_returned);