This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Three failing testcases
- To: egcs-bugs at cygnus dot com
- Subject: Three failing testcases
- From: Wolfgang Bangerth - home account <wolf at gaia dot iwr dot uni-heidelberg dot de>
- Date: Mon, 20 Jul 1998 05:34:15 +0200 (MET DST)
- Reply-To: Wolfgang Bangerth - home account <wolf at gaia dot iwr dot uni-heidelberg dot de>
Hi there,
this is my personal collection of bugs in egcs, which still are in the
latest snapshot (egcs-2.91.50 19980714 (gcc2 ss-980609 experimental)
(i386 Linux/ELF)). I posted these in the past, but unfortunately don't
know whether they have been added to the testcase collection. Could
someone drop me a note if s/he has done so or does so?
Regards
Wolfgang
Ok, here are the code snippets. Everything was compiled with -Wall on
an Intel/Linux 2.0.33.
1./ Run the following program and the assertion will fail. This
happens because of some confusion with the general template
and the explicit specialization of Derived<>.
-------------------------------------------------------------
#include <cassert>
struct Base1 { int local1; };
struct Base2 { int local2; };
template <int dim> class Derived;
class Derived<1> : public Base1, public Base2 {};
template <int dim>
class FinalClass : public Derived<dim> {
public:
FinalClass () {
assert (&local1 != &local2);
};
};
void main () {
FinalClass<1> a1;
};
--------------------------------------------------------------
2./ Some confusion about template parameters and constant
expressions. Note the interesting difference whether the
base class has or has not copy constructor and assignment
operator.
This is the output of egcs:
test3.cc: In method `void bar<2>::foo1<2>(struct Base1<2> = Base1<dim>())':
test3.cc:20: no matching function for call to `Base1<dim>::Base1 (Base1<dim>)'
test3.cc:2: candidates are: Base1<dim>::Base1<2>(Base1<2> &)
test3.cc: At top level:
test3.cc: In instantiation of `Base2<dim>':
test3.cc:27: instantiated from here
test3.cc:27: type `Base2<2>' is not a base type for type `Base2<dim>'
test3.cc:27: common_type called with uncommon aggregate types (compiler error)
test3.cc:27: confused by earlier errors, bailing out
---------------------------------------------------------------
template <int dim> struct Base1 {
Base1 (Base1<dim> &);
Base1<dim> & operator = (Base1<dim> &);
};
template <int dim> struct Base2 {
};
template <int dim> struct bar{
public:
void foo1 (Base1<dim> p = Base1<dim>());
void foo2 (Base2<dim> p = Base2<dim>());
};
template <>
void bar<2>::foo1 (Base1<2> p) {
const unsigned int dim = 2;
Base1<dim> q = p;
};
template <>
void bar<2>::foo2 (Base2<2> p) {
const unsigned int dim = 2;
Base2<dim> q = p;
};
---------------------------------------------------------------
3./ An ICE at a place where it should not happen. The compiler crashes at
the bogus line. If the "set" class is not templated, the compiler
emits the correct message.
---------------------------------------------------------------
template <class T> class set;
class X {};
void foo (X &x) {
x.set (); // this code is bogus, of course...
};
---------------------------------------------------------------