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

--- Comment #18 from Dodji Seketeli <dodji at gcc dot gnu.org> 2010-11-02 
14:19:04 UTC ---
"fang at csl dot cornell.edu" <gcc-bugzi...@gcc.gnu.org> writes:

> Meanwhile, I've been trying to find some source workaround for my example 
> until
> this is patched and the next release is out.  Can you think of any?

Hmmh. Maybe try to avoid using pointers to members as template arguments
for now? Or if you do, try to avoid having two (or more) function
templates of the same name, whith one of the templates expecting a
pointer to member as an argument.

>
> Just to clarify: the test case I pasted isn't related to substitution failure
> or SFINAE, is it?

I think it is, and here is why.

While looking at the expression
&options_map_impl_type::set_member_constant<bool,
                                             &cflat_options::show_precharges,
                         true>,
the compiler tries to find the proper
options_map_impl_type::set_member_constant template to instantiate.

A set of candidate templates is built from the two possible
options_map_impl<cflat_options>::set_member_constant template you have
there. For each template, the compiler tries to deduce the template
arguments that match the template parameters, using the argument {bool,
&cflat_optionss::show_precharges, and true} that are given.

The first template ->|<- template <class V, V K> static bool
set_member_constant(const option_value&, options_struct_type&, V
options_struct_type::*); ->|<- is considered, but the argument deduction
fails because the template doesn't have the right number of
arguments. This failure should not be an error and we should then
consider the second function template. The bug is that we emit and error
and stop right there instead of keep going. And we stop specifically
while looking at the pointer to member constant.

Reply via email to