This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/29927] template instantiation with function type
- From: "s__nakayama at infoseek dot jp" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Nov 2006 14:57:12 -0000
- Subject: [Bug c++/29927] template instantiation with function type
- References: <bug-29927-10812@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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