
Sergey Shandar wrote:
According to the standard, the code should not work.
14.8.2.2
- All references in the function type of the function template to the corresponding template parameters are replaced by the specified template argument values. If a substitution in a template parameter or in the function type of the function template results in an invalid type, type deduction fails. [Note: *The equivalent substitution in exception specifications is done only when the function is instantiated, at which point a program is ill-formed if the substitution results in an invalid type.*] Type deduction may fail for the following reasons:
However, it works on GCC. So, the workaround uses just another bug in GCC :-)
I too found that clause yesterday! http://tinyurl.com/22b4b7 Anyway your workaround is great. :-) Regards, -- Shunsuke Sogame