This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
bug g++
- To: gcc-bugs at gcc dot gnu dot org
- Subject: bug g++
- From: Grégoire Lecerf <Gregoire dot Lecerf at gage dot polytechnique dot fr>
- Date: Thu, 26 Oct 2000 14:24:32 +0200
- CC: aldaz at gage dot polytechnique dot fr
- Organization: Ecole polytechnique
- Reply-To: Gregoire dot Lecerf at gage dot polytechnique dot fr
Hello,
I ran into this bug these last days. I managed to isolate it into a
small file
test8.C (with no #include!). The output of
g++ -v -save-temps test8.C
is in the BUGREPPORT file in attachment.
I have just tried the "CodeSourcery's Online Test Compilation" web site
without any success.
Thank you very much in advance.
Regards,
Grégoire.
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.0)
/usr/lib/gcc-lib/i386-redhat-linux/2.96/cpp0 -lang-c++ -D__GNUG__=2 -v -D__GNUC__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -Wall -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tune_i386__ test8.C /tmp/ccDamCNg.ii
GNU CPP version 2.96 20000731 (Red Hat Linux 7.0) (cpplib)
(i386 Linux/ELF)
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/g++-3
/usr/local/include
/usr/lib/gcc-lib/i386-redhat-linux/2.96/include
/usr/include
End of search list.
/usr/lib/gcc-lib/i386-redhat-linux/2.96/cc1plus /tmp/ccDamCNg.ii -quiet -dumpbase test8.C -Wall -version -o /tmp/ccjmOJqq.s
GNU C++ version 2.96 20000731 (Red Hat Linux 7.0) (i386-redhat-linux) compiled by GNU C version 2.96 20000731 (Red Hat Linux 7.0).
test8.C: In instantiation of `Promote<C>':
test8.C:109: instantiated from here
test8.C:105: Internal compiler error in lookup_template_class, at
../gcc/cp/pt.c:4058
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
/*
BUG localization
GL, Oct 2000.
*/
struct MTE_Null {};
struct MTE_List_Null{};
template<class X,class Tail>
struct MTE_List{
typedef X element;
typedef Tail tail;
};
#define MTE_LIST_0() MTE_List_Null
#define MTE_LIST_1(A) MTE_List<A,MTE_List_Null>
#define MTE_LIST_2(A,B) MTE_List<A,MTE_LIST_1(B)>
/////// IsEmptyList
template<class L>
struct MTE_IsEmptyList {
static const bool ans= 0;
};
template<>
struct MTE_IsEmptyList<MTE_List_Null> {
static const bool ans= 1;
};
//////// IsInList
template<class L>
struct MTE_IsInList;
template<class L>
struct MTE_IsInList{
template<class E>
struct ans{
typedef typename L::element tmp;
typedef MTE_IsInList<typename L::tail> tmp0;
typedef typename tmp0::ans<E> tmp1;
static const bool ret=(E::__name__== tmp::__name__) || (tmp1::ret);
};
};
template<>
struct MTE_IsInList<MTE_List_Null>{
template<class E>
struct ans{
static const bool ret=0;
};
};
/////// IF
struct SelectThen{
template<class T, class E>
struct Result{
typedef T ans;
};
}; // end SelectThen
struct SelectElse{
template<class T, class E>
struct Result{
typedef E ans;
};
}; // end SelectElse
template<bool Condition>
struct Selector{
typedef SelectThen ans;
}; // end Selector
template<>
struct Selector<false>{
typedef SelectElse ans;
}; // end Selector<false>
template<bool C, class T, class E>
struct IF{
typedef typename Selector<C>::ans select;
typedef typename select::Result<T,E>::ans ans;
}; // IF
// for demo
struct A {
static const int __name__=1;
typedef MTE_LIST_0() __Parents;
};
struct B {
static const int __name__=2;
typedef MTE_LIST_0() __Parents;
};
struct C {
static const int __name__=3;
typedef MTE_LIST_2(A,B) __Parents;
};
template<class X>
struct Promote{
typedef typename X::__Parents tmp1;
typedef typename MTE_IsInList<tmp1>::ans<A> tmp0;
static const bool tmp=tmp0::ret;
typedef typename IF<tmp, A, B>::ans ans;
};
typedef typename Promote<C>::ans TOTO;
int main(void) {
TOTO a;
}