diff options
author | Nathan Sidwell <nathan@acm.org> | 1999-04-27 09:41:33 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 1999-04-27 09:41:33 +0000 |
commit | f915e937d9428193c15fb01d0d337d8eaeaecf1a (patch) | |
tree | 603a3e01ddc0e6e57f083c0c2010b040059626f9 /gcc | |
parent | 0118fd7deb1cfc6827f7de016d75c7aae8cc7afd (diff) | |
download | gcc-f915e937d9428193c15fb01d0d337d8eaeaecf1a.zip gcc-f915e937d9428193c15fb01d0d337d8eaeaecf1a.tar.gz gcc-f915e937d9428193c15fb01d0d337d8eaeaecf1a.tar.bz2 |
* rtti.c (build_x_typeid): Check rtti is enabled.
From-SVN: r26675
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/rtti.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/rtti5.C | 14 |
3 files changed, 26 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3124a49..2d6e496 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +1999-04-27 Nathan Sidwell <nathan@acm.org> + + * rtti.c (build_x_typeid): Check rtti is enabled. + 1999-04-26 Mark Mitchell <mark@codesourcery.com> * search.c (is_subobject_of_p): Make sure we're looking at the diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 79fb800..e0ce5cd 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -261,9 +261,15 @@ build_x_typeid (exp) tree exp; { tree cond = NULL_TREE; - tree type = TREE_TYPE (tinfo_fn_type); + tree type; int nonnull; + if (! flag_rtti) + { + error ("cannot use typeid with -fno-rtti"); + return error_mark_node; + } + if (TYPE_SIZE (type_info_type_node) == NULL_TREE) { error ("must #include <typeinfo> before using typeid"); @@ -288,6 +294,7 @@ build_x_typeid (exp) if (exp == error_mark_node) return error_mark_node; + type = TREE_TYPE (tinfo_fn_type); exp = build_call (exp, type, NULL_TREE); if (cond) diff --git a/gcc/testsuite/g++.old-deja/g++.other/rtti5.C b/gcc/testsuite/g++.old-deja/g++.other/rtti5.C new file mode 100644 index 0000000..38a5146 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/rtti5.C @@ -0,0 +1,14 @@ +// Build don't link: +// Special g++ Options: -fno-rtti + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 9 Apr 1999 <nathan@acm.org> +// derrived from bug report from Alexander Zvyagin <zvyagin@mx.ihep.su> + +// check we don't die with disabled rtti + + +int main(void) { + int i; + typeid(i); // ERROR - rtti disabled +} |