← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] compile broken on clang - overload conflict

 

GCC was still generating a warning using the reference as well so I
applied your patch in r5722.

Thanks,

Wayne

On 6/8/2015 10:08 AM, Chris Pavlina wrote:
> Nope, using a by-reference parameter does not appease clang; no idea about MSVC.
> 
> 
> On Mon, Jun 08, 2015 at 09:15:16AM -0400, Wayne Stambaugh wrote:
>> On 6/8/2015 8:58 AM, Chris Pavlina wrote:
>>> It can't and it shouldn't - gcc is the one at fault here. wxString 
>>> provides the constructor:
>>>
>>> wxString(char ch, size_t nRepeat=1)
>>>
>>> which is the one in question, I believe, as the integer literal can also 
>>> represent a character.
>>>
>>> Using a reference should work too, though changing the name is a more 
>>> common solution (and better IMHO) particularly considering the two 
>>> methods do provide slightly different functions.
>>
>> I would think that searching a list with a string vs. an index is pretty
>> self explanatory but maybe I've been doing this too long :)
>>
>>>
>>> Apparently MSVC won't compile it either.
>>>
>>> On Mon, Jun 08, 2015 at 08:50:15AM -0400, Wayne Stambaugh wrote:
>>>> Really!  Clang can't differentiate between
>>>>
>>>> SCH_SHEET_LIST::GetSheet(const wxString, bool);
>>>>
>>>> and
>>>>
>>>> SCH_SHEET_LIST::GetSheet(int);
>>>>
>>>> How can these two definitions be ambiguous?  Does using a reference to
>>>> the wxString instead of passing the entire string on the stack fix the
>>>> problem?  If so, I would prefer that fix.
>>>>
>>>> On 6/7/2015 9:17 PM, Chris Pavlina wrote:
>>>>> 5720 broke the build on clang by making SCH_SHEET_LIST::GetSheet(int) a 
>>>>> const method, which changed the overload resolution order and resulted 
>>>>> in failure due to ambiguity. This patch ranames 
>>>>> SCH_SHEET_LIST::GetSheet(const wxString, bool) to ::GetSheetByPath to 
>>>>> resolve that conflict.
>>>>>
>>>>> --
>>>>> Chris
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 


References