On Wed, Dec 15, 2010 at 5:26 PM, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote: > On 15 December 2010 08:50, zhang qingshan wrote: >> >> Sadly, I cannot understand what the situation would be if T is >> replaced by function. > > That is governed by 8.3.5 not 8.3.2 > >> When the template argument substitudition happens, T --> void (), >> const T --> void (), as it is a const qualifier function, which const >> is ignore. >> finally, reference apply for this type descriptor. const T& --> >> void(&)(). I believe that, I have missed something here. > > > I showed in my example that void (const&)() and void(&)() are equivalent. > > The reason you can't compile your other examples is only because > you're using invalid syntax. C++ has very unhelpful declarator syntax > for function types. > T--> void(), const T-->void() const T& -->void (&)(), however, the linker complain that, test.cpp:(.text+0x1c): undefined reference to `void fun<void()()>(void ( const&)())' It seems that, gcc still resolve it as void (const &)(), not void(&)(). I do agree with you that, they are equivalent. But from the view of the std rules, there shouldn't be a const here(it should be ignored when it applies to the function). Besides, void (const &)() is not a valid syntax as well. Thanks.