Commit ffb690bd by Jason Merrill

[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
parent 51cbea76
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.
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment