------- Comment #3 from s__nakayama at infoseek dot jp  2006-11-22 14:57 -------
(In reply to comment #2)
(In reply to comment #2)
> What exactly do you expect the code to do? 
>   foo<int ()>();
> leads to an instantiation of foo<T> with 
>   T= int()()
> i.e. reference to "no-arg function returning int". From
> thereon I am a bit confused what exactly you intend to
> do in foo()...

I expected that the compiler reject it. 
But Comeau compiler also accepted this code.
gcc 2.95.3 don't generate code that causes segmentation fault.(LINK error)
another test case:
following invalid code causes ICE.

template <class T>
void foo()
{
  T bar = 0;
  bar();
}

int main()
{ 
  foo<int ()>();
  return 0;
}


-- 


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

Reply via email to