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]
Other format: [Raw text]

[Bug c++/48261] New: internal compiler error: in lookup_template_function, at cp/pt.c:6227


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48261

           Summary: internal compiler error: in lookup_template_function,
                    at cp/pt.c:6227
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dtag00@gmail.com


Created attachment 23762
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23762
File that GCC asked me to attach to this bug report.

Hi,
I encountered the compiler error:

internal compiler error: in lookup_template_function, at cp/pt.c:6227

I reproduced the error in a small test program:

----------------

struct Foo
{
template<typename T>
static T add(T a, T b)
{
return a+b;
}
};

double gadd(double a, double b)
{
return a+b;
}

typedef double (*gaddType)(double,double);
struct Foo2
{
static gaddType add;
};
gaddType Foo2::add=&gadd;


template<typename T>
struct Something 
{
void work()
{
double x=T::template add<double>(5.0,6.0);
}
};

int main()
{
Something<Foo> s;
s.work();

Something<Foo2> s2;
s2.work();
}

----------------

$ g++ a.cpp
a.cpp: In member function âvoid Something<T>::work() [with T = Foo2]â:
a.cpp:38:9:   instantiated from here
a.cpp:28:41: internal compiler error: in lookup_template_function, at
cp/pt.c:6227
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccj7WbC1.out file, please attach this to
your bugreport.


Admittedly the program doesn't make much sense but there still shouldn't be an
internal compiler error. Took me a while to figure out the cause of the problem
in my actual program.

I use GCC 4.5.1 (a friend also tried it on 4.5.2 with the same effect).
The file mentioned in the error message is attached to this bug report.

Thanks


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