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]

GCC behave different for cv-qualifier function.


std 8.3.2/1 says

Cv-qualified references are ill-formed except when the cv-qualifiers
are introduced through
the use of a typedef (7.1.3) or of a template type argument (14.3), in
which case the cv-qualifiers are ignored

following code is tested at GCC 4.5.0.

template <typename T>
void fun(const T&t);
void foo();
void Test() {
 fun(foo);
}

It seems that, fun should be resolved as void (void (&)()), as const
is ignore here.
However, if I try to link this problem, the link complains:

test.cpp:(.text+0x1c): undefined reference to `void fun<void
()()>(void ( const&)())'

Why the fun here is resolved as void fun<void()()>(void ( const &)())
rather than void fun<void()()>(void ( &)()) ?

Thanks.


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