> 
> Oct 31, 2011 11:56:59 AM, ja...@redhat.com wrote:
> 
> On 10/30/2011 01:13 PM, Ed Smith-Rowland wrote:
> > +  /* Look for a literal operator taking the exact type of numeric argument
> > +     as the literal value.  */
> 
> Is this right?  Do numeric literals only get here with type unsigned 
> long long or long double?

Yes, the preprocessor interprets a numeric literal either as integral or 
floating point in the usual way.  If an unrecognized suffix is found then the 
numeric part is interpreted as unsigned long long or as long double as 
appropriate.  This happens in the lexer.  Anything with a double quoted front 
part is sent to string literal.  Anything with a single quoted bit is set to 
char literal.

> > +  while (fns)
> >      {
> >        tree tmpl_args = make_char_string_pack (num_string);
> > -      decl = lookup_template_function (decl, tmpl_args);
> > -      result = finish_call_expr (decl, &args, false, true, tf_none);
> > -      if (result != error_mark_node)
> > +      tree fn = OVL_CURRENT (fns);
> > +      tree argtypes = NULL_TREE;
> > +      if (TREE_CODE (TREE_TYPE (fn)) != LANG_TYPE)
> > + argtypes = TYPE_ARG_TYPES (TREE_TYPE (fn));
> > +      if (argtypes != NULL_TREE
> > +   && same_type_p (TREE_VALUE (argtypes), void_type_node))

> Let's wait to make the pack until we find a template.  Also, you should 
> be able to just check for TEMPLATE_DECL since we won't accept a literal 
> operator template with different parameter types.

> For string and character literals, we can still just build up a call; we 
> only need to walk the overload list here for numeric literals.

I found that if you don't walk the overload list for chars, a char could be 
routed to the operator taking wchar_t for example.  This is similar to the 
comment you made for numeric literals - 1.2_foo potentially going to operator"" 
_foo(long long unsigned).  I think for strings you may be right.

Jason

Reply via email to