There seems to be a problem with multipile inheritence and template
the attached code compile on gcc 3.2.2 and fail on gcc 3.4.2
the same code with only one inheritace (delete class c) pass compile
compiler version
c++ -v
Reading specs from /insightix/local/bin/../lib/gcc/i686-pc-linux-gnu/3.4.2/specs
Configured with: ../configure --prefix=/insightix/local/
Thread model: posix
gcc version 3.4.2
gcc build configuration options
../configure --prefix=/usr/local/gcc_test
c++ test.cpp
In file included from test.cpp:2:
test.h: In constructor `c<T, R>::c()':
test.h:23: error: `int_b' undeclared (first use this function)
test.h:23: error: (Each undeclared identifier is reported only once for each
function it appears in.)
test.h:23: error: `int_a' undeclared (first use this function)
test.cpp
#include "test.h"
int main(void){
c<int,int> class_c;
return 0;
}
test.h
#ifndef __TEST_H
#define __TEST_H
class a{
public:
int int_a;
a() {int_a = 0;}
~a() {};
};
template<class T, class R> class b: public a{
public:
int int_b;
b<T,R>() {int_b = 0; int_a = 1;}
};
template<class T, class R> class c: public b<T,R>{
public:
int int_c;
c<T,R>() {int_c = 0; int_b = 1; int_a = 2;}
};
#endif
--
Summary: templates with multipile inheritence fail compile
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: amir at spinux dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: x86
GCC target triplet: x86
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18286