old-cross-binutils/gdb/testsuite/gdb.cp/rtti1.cc
David Carlton b368761e45 2004-01-23 David Carlton <carlton@kealia.com>
Partial workaround for PR c++/1511:
	* cp-namespace.c: Include frame.h.
	(cp_lookup_transparent_type): New
	(cp_lookup_transparent_type_loop): New.
	* cp-support.h: Declare cp_lookup_transparent_type.
	* symtab.c (basic_lookup_transparent_type): Renamed from
	lookup_transparent_type.
	(lookup_transparent_type): Replace old body by a call to
	current_language->la_lookup_transparent_type.
	* symtab.h: Update copyright.  Declare
	basic_lookup_transparent_type.
	* language.h: Update copyright.
	(struct language_defn): Add la_lookup_transparent_type.
	* language.c: Update copyright.
	(unknown_language_defn): Add basic_lookup_transparent_type.
	(auto_language_defn): Add basic_lookup_transparent_type.
	(local_language_defn): Add basic_lookup_transparent_type.
	* ada-lang.c: Update copyright.
	(ada_language_defn): Add basic_lookup_transparent_type.
	* c-lang.c: Update copyright.
	(c_language_defn): Add basic_lookup_transparent_type.
	(cplus_language_defn): Add basic_lookup_transparent_type.
	(asm_language_defn): Add basic_lookup_transparent_type.
	(minimal_language_defn): Add basic_lookup_transparent_type.
	* f-lang.c: Update copyright.
	(f_language_defn): Add basic_lookup_transparent_type.
	* jv-lang.c: Update copyright.
	(java_language_defn): Add basic_lookup_transparent_type.
	* m2-lang.c: Update copyright.
	(m2_language_defn): Add basic_lookup_transparent_type.
	* objc-lang.c: Update copyright.
	(objc_language_defn): Add basic_lookup_transparent_type.
	* p-lang.c: Update copyright.
	(p_language_defn): Add basic_lookup_transparent_type.
	* scm-lang.c: Update copyright.
	(scm_language_defn): Add basic_lookup_transparent_type.
	* Makefile.in (cp-namespace.o): Depend on frame.h.

2004-01-23  David Carlton  <carlton@kealia.com>

	* gdb.cp/rtti.exp: Don't include full path in ${srcfile}.  Add
	test for cp_lookup_transparent_type.
	* gdb.cp/rtti1.cc: Update copyright.  Add n2::func and refer_to;
	call them.
2004-01-23 23:03:31 +00:00

89 lines
1.8 KiB
C++

/* Code to go along with tests in rtti.exp.
Copyright 2003, 2004 Free Software Foundation, Inc.
Contributed by David Carlton <carlton@bactrian.org> and by Kealia,
Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "rtti.h"
namespace n1 {
class C1;
class Base1 {
public:
virtual ~Base1() { }
};
class C1: public Base1 {
public:
};
class D1 : public C1{
public:
D1(C1 *, C1 *);
C1* expr_1_;
C1* expr_2_;
};
D1::D1(C1 *expr_1, C1 *expr_2)
: expr_1_(expr_1), expr_2_(expr_2) { }
C1 *create1() {
return new D1(0, 0);
}
} // n1
// NOTE: carlton/2004-01-23: This call exists only to convince GCC to
// keep around a reference to 'obj' in n2::func - GCC 3.4 had been
// optimizing it away.
void refer_to (n2::C2 *obj)
{
// Do nothing.
}
namespace n2
{
void func ()
{
C2 *obj = create2 ();
refer_to (obj); // func-constructs-done
return;
}
}
int main()
{
using namespace n1;
using namespace n2;
C1 *e1 = create1();
C2 *e2 = create2();
n2::func(); // main-constructs-done
return 0;
}