This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
static array of label addresses in function templates?
- From: Földy Lajos <foldy at rmki dot kfki dot hu>
- To: <gcc at gcc dot gnu dot org>
- Date: Fri, 23 Aug 2002 16:32:46 +0200 (CEST)
- Subject: static array of label addresses in function templates?
Hi,
the following code produces an error message. Is the code wrong or
I really can't have such static data in function templates?
(with an ordinary function [ int fun(int i) ] it works).
thanks,
lajos foldy
######################################################################
#include <iostream>
template<class T>
int fun(T i)
{
static void* labs[2] = { &&lab1, &&lab2 };
goto *(labs[i==0]);
lab1: return 1;
lab2: return 2;
return 0;
}
int main()
{ std::cout << fun(1) << std::endl;
}
######################################################################
foldy@bombur:~> g++-3.2 a.cc
a.cc: In function `int fun(T) [with T = int]':
a.cc:18: instantiated from here
a.cc:7: Internal compiler error in find_function_data, at function.c:329
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
foldy@bombur:~>