This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Regression with pmfs??



	The following code exposes a regression (AFAIK) with definitions 
of pointer to member functions... This behaviour did not show up 
before (cvs from begining of september). I guess this is related to 
the new modifications made to the compiler to better handle pmfs but 
I do not see what is wrong with the code, so I assume this might be a 
bug.

g++ -Wall -c Bug.C -o Bug.o
Bug.C: In method `double B::R(int) const':
Bug.C:26: not enough type information
Bug.C:25: warning: unused variable `const double (B::* D2)() const'
Bug.C:24: warning: unused variable `const double (B::* D1)() const'

Note: The two line defining D1 and D2 do not compile if I remove the 
class spec "A::". Why do I have to specify this ??

	Thank's a lot ....

	Theo.

class A {
public:

    A()  { }
    ~A() { }

    const double A1() const { return 1.0; }
    const double A2() const { return 2.0; }
};

class B: public A {
public:

    B() { }
    ~B() { }

    double R(const int) const;
};

double
B::R(const int i) const
{
	typedef const double (B::*Func)() const;
	const Func D1 = &A::A1;
	const Func D2 = &A::A2;
	const Func DD = (i==2) ? &A1: &A2;

	return (this->*DD)();
}


(gdb) run
Starting program: /u/corse/2/robotvis/gnu/bin/egcs/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.92.16/cc1plus Bug.C
 A::A() A::~A() const double A::A1() const const double A::A2() const B::B() B::~B() double B::R(int) const
Breakpoint 1, instantiate_type (lhstype=0x29edf0, rhs=0x2bdbc8, complain=1)
    at ../../../egcs/gcc/cp/class.c:4982
4982      if (TREE_CODE (lhstype) == UNKNOWN_TYPE)
(gdb) n
4979      tree explicit_targs = NULL_TREE;
(gdb) 
4982      if (TREE_CODE (lhstype) == UNKNOWN_TYPE)
(gdb) 
4984          if (complain)
(gdb) 
4985            error ("not enough type information");
(gdb) list
4980      int template_only = 0;
4981
4982      if (TREE_CODE (lhstype) == UNKNOWN_TYPE)
4983        {
4984          if (complain)
4985            error ("not enough type information");
4986          return error_mark_node;
4987        }
4988
4989      if (TREE_TYPE (rhs) != NULL_TREE && ! (type_unknown_p (rhs)))
(gdb) call debug_tree(lhstype)
 <lang_type 29edf0 unknown type type <lang_type 29edf0 unknown type>
    allocated from permanent_obstack
    permanent VOID
    size <integer_cst 29a888 type <integer_type 296e68 unsigned int> constant permanent 0>
    align 1 symtab 0 alias set -1
    pointer_to_this <lang_type 29edf0 unknown type> reference_to_this <lang_type 29edf0 unknown type>>

(gdb) bt
#0  instantiate_type (lhstype=0x29edf0, rhs=0x2bdbc8, complain=1)
    at ../../../egcs/gcc/cp/class.c:4985
#1  0x67dc4 in require_instantiated_type (type=0x29edf0, exp=0x2bdbc8, 
    errval=0x2966b8) at ../../../egcs/gcc/cp/typeck.c:228
#2  0x6fee4 in build_conditional_expr (ifexp=0x2bdb08, op1=0x2bdbc8, 
    op2=0x2bdc88) at ../../../egcs/gcc/cp/typeck.c:5027
#3  0x15f00 in build_new_op (code=COND_EXPR, flags=3, arg1=0x2bdb08, 
    arg2=0x2bdbc8, arg3=0x2bdc88) at ../../../egcs/gcc/cp/call.c:2803
#4  0x6fe48 in build_x_conditional_expr (ifexp=0x2bdb08, op1=0x2bdbc8, 
    op2=0x2bdc88) at ../../../egcs/gcc/cp/typeck.c:5000
#5  0x60658 in yyparse () at parse.y:1269
#6  0x92310 in compile_file (name=0xeffff31b "Bug.C")
    at ../../egcs/gcc/toplev.c:2805
#7  0x95c38 in main (argc=2, argv=0xeffff114) at ../../egcs/gcc/toplev.c:4892

 --------------------------------------------------------------------
 Theodore Papadopoulo
 Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
 --------------------------------------------------------------------





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]