aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-10-26 02:07:12 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-10-25 21:07:12 -0500
commit86910c53b6301f301d093a8de8e8794e90c5ee00 (patch)
treeac71ec70c6d0a2dc7df491a80fe4e6cbccb00473
parenta28e148a865f17a858cd8aa7acbbe1390896e6dd (diff)
downloadgcc-86910c53b6301f301d093a8de8e8794e90c5ee00.zip
gcc-86910c53b6301f301d093a8de8e8794e90c5ee00.tar.gz
gcc-86910c53b6301f301d093a8de8e8794e90c5ee00.tar.bz2
typeck2.c (check_for_new_type): Only depend on pedantic for C-style casts.
* typeck2.c (check_for_new_type): Only depend on pedantic for C-style casts. From-SVN: r23342
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/typeck2.c6
2 files changed, 7 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0501bca..00e5f79 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -10,7 +10,8 @@
* init.c (build_member_call): Don't try to convert to the base type
if it's ambiguous.
- * typeck2.c (check_for_new_type): Don't depend on pedantic.
+ * typeck2.c (check_for_new_type): Only depend on pedantic for
+ C-style casts.
1998-10-25 Mark Mitchell <mark@markmitchell.com>
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 8fa70c9..fc05514 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1654,11 +1654,15 @@ report_case_error (code, type, new_value, old_value)
}
#endif
+/* Complain about defining new types in inappropriate places. We give an
+ exception for C-style casts, to accommodate GNU C stylings. */
+
void
check_for_new_type (string, inptree)
char *string;
flagged_type_tree inptree;
{
- if (inptree.new_type_flag)
+ if (inptree.new_type_flag
+ && (pedantic || strcmp (string, "cast") != 0))
pedwarn ("ANSI C++ forbids defining types within %s",string);
}