diff options
author | Jason Merrill <jason@gcc.gnu.org> | 1997-10-08 02:04:28 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1997-10-08 02:04:28 -0400 |
commit | ffb690bd0862a35dd74a4abdc9c261ad7611a457 (patch) | |
tree | 56e1a0e652c0365adc29984d4f8015790e87d229 /gcc | |
parent | 51cbea761be56017136003c9d81b0acf4aeba6aa (diff) | |
download | gcc-ffb690bd0862a35dd74a4abdc9c261ad7611a457.zip gcc-ffb690bd0862a35dd74a4abdc9c261ad7611a457.tar.gz gcc-ffb690bd0862a35dd74a4abdc9c261ad7611a457.tar.bz2 |
[multiple changes]
Tue Oct 7 23:00:12 1997 Mark Mitchell <mmitchell@usa.net>
* 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 <jason@yorick.cygnus.com>
* typeck.c (build_reinterpret_cast): Tweak.
Tue Oct 7 22:45:31 1997 Alexandre Oliva <oliva@dcc.unicamp.br>
* 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 <bruno@linuix.mathematik.uni-karlsruhe.de>
* typeck.c (c_expand_return): Don't warn about returning a
reference-type variable as a reference.
From-SVN: r15876
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 20 | ||||
-rw-r--r-- | gcc/cp/decl.c | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 11 |
3 files changed, 35 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 712e118..b3d1795 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,23 @@ +Tue Oct 7 23:00:12 1997 Mark Mitchell <mmitchell@usa.net> + + * 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 <jason@yorick.cygnus.com> + + * typeck.c (build_reinterpret_cast): Tweak. + +Tue Oct 7 22:45:31 1997 Alexandre Oliva <oliva@dcc.unicamp.br> + + * 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 <bruno@linuix.mathematik.uni-karlsruhe.de> + + * 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 <jason@yorick.cygnus.com> * method.c (build_static_name): Fix typo. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 4f6f982..9c89670 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 797cd3d..96d1c26 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); |