This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Possible bug in compiler ?


Hi,
 
We've encountered a problem using g++ compiler version
4.1.2 (that was the latest we downloaded). Seems like
a bug but, we are not shore. We didn't find any
related problem in the mailing list.
Here is a simplified code that causes the problem:

/////////////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
template <typename T, int v> class record_descriptor
{
public:
    void operator()()
    {
        printf("Global template\n");
    }
};
template<typename T, int v, template<typename,int>
class RD = record_descriptor> class TableRecord
{
public:
    TableRecord()
    {
        RD<T, v> d;
        d();
    }
};
template<typename A> class Attr
{
public:
    template <typename T, int v> class
i_record_descriptor
    {
    public:
        void operator()()
        {
            printf("Inner template\n");
        }
    };
    template <int v> class i_record_descriptor<A, v>
    {
    public:
        void operator()()
        {
            printf("Inner spec template\n");
        }
    };
    Attr()
    {
        TableRecord<A, 1, i_record_descriptor> tr;
    }
};
int main()
{
    Attr<int> attr;
    return 0;
}
/////////////////////////////////////////////////////////////////////////////////
It compiles fine, but the result after running the
executable is "Inner template" instead of "Inner spec
template".

Can somebody help us to find out what is wrong?

The compiler's exact version is:
g++ (GCC) 4.1.2 20060901 (prerelease) (Debian
4.1.1-13)


Thanks in advance!

Zoltan.



 
____________________________________________________________________________________
We have the perfect Group for you. Check out the handy changes to Yahoo! Groups 
(http://groups.yahoo.com)


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