[cfe-commits] r127460 - in /cfe/trunk: lib/Sema/SemaType.cpp test/SemaCXX/return.cpp

Johannes Schaub (litb) schaub.johannes at googlemail.com
Fri Mar 11 08:22:06 PST 2011


Rafael Avila de Espindola wrote:

>> If we want to warn on extraneous qualifiers for conversions functions, I
>> feel like that should be a separate warning tailored to the situation.
>> Calling it a 'return type' is a bit confusing.
> 
> True. Also, is the const in
> 
> class foo  {
>    operator int * const ();
> };
> 
> really redundant? Are there cases where that operator would be selected
> but one without a const would not?
> 

Also consider this one:

  struct foo {
    operator int * const();
  };

  struct bar : foo {
    operator int * const();
  };

  bar b;
  int *x = b;

If you remove the const in "bar" or "foo" (but not both), the conversion to 
"int*" will be ambiguous, because the derived conversion function doesn't 
hide the base conversion function anymore. 





More information about the cfe-commits mailing list