This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14032] New: non type boolean template argument partial specialization to argument in parent never matches
- From: "tschwinger at neoscientists dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Feb 2004 20:54:35 -0000
- Subject: [Bug c++/14032] New: non type boolean template argument partial specialization to argument in parent never matches
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Compiled with gcc 3.3.1 (cygwin), 3.2.3 (gentoo-linux), mingw32 3.2 the test
code included in this report generates an endless recursion.
It compiles without errors or warnings so the underlying problem can be quite
hard to track for the user.
$ cat <<EOF >test.cpp
#include <iostream>
template <bool compare>
struct outer
{
template <bool compare_with,bool second>
struct inner // unspecialized compare != compare_with
{
static inline void test()
{
std::cout << "invert" << std::endl;
// call version with inverted template value
inner<! compare_with, ! second>::test();
}
};
template <bool second> // specialization compare == compare_with
struct inner<compare,second>
{
static inline void test()
{
std::cout << "second: " << second << std::endl;
}
};
};
int main(int argc,char* argv[],char** envp)
{
// expected output:
// invert
// second: true
outer<false>::inner<true,false>::test();
// expected output:
// second: false
outer<true>::inner<true,false>::test();
return 0;
}
EOF
$ make test && ./test
--
Summary: non type boolean template argument partial
specialization to argument in parent never matches
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tschwinger at neoscientists dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14032