Skip to content

Regression: ofParameter<T1> = ofParameter<T2> if T1 and T2 are convertible. Operator = is ambiguous. #8332

@eduardfrigola

Description

@eduardfrigola

Hi!

While testing for the 0.12.1 release, I found a regression in ofParameter.

To reproduce the issue just assign two convertible ofParameters, for example an ofParameter<float> to an ofParameter<int> or viceversa.

ofParameter<float> pFloat = 3.3;
ofParameter<int> pInt = 3;
pFloat = pInt;

The two candidate functions are:

ofParameter<ParameterType> & operator=(const ofParameter<ParameterType> & v);
const ParameterType & operator=(const ParameterType & v);

My suspicion is that this bug was introduced with this new ctor in commit 5f8dfc4

template <
typename Arg,
typename = std::enable_if_t<(!(std::is_convertible_v<Arg, std::string> and std::is_same_v<ParameterType, std::string>) and
std::is_convertible_v<Arg, ParameterType> and
!((std::is_same_v<ParameterType, bool>)and!(std::is_arithmetic_v<Arg>)))>>
ofParameter(const Arg & v);

As in issue #8294 this was discovered using ofxOceanode with latest proposed 0.12.1 release changes.

Eduard

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions