Indiana Unversity logo[ConceptGCC]

ConceptGCC :

Overload resolution bug calling associated non-member functions with ConceptGCC-BoostCon

From: Tom Honermann (tom.honermann_at_[hidden])
Date: 2007-06-14 05:05:42


Compiling the following code with conceptgcc-boostcon on Linux/x86
results in this error message:

    file.cpp: In function 'int Action(const color_type&) [with
    color_type = color]':
    file.cpp:25: instantiated from here
    file.cpp:21: error: no matching function for call to 'tint(const
    color&)'
    file.cpp:5: note: candidates are: int&
    Color<color_type>::tint(color_type&)
    file.cpp:4: note: int Color<color_type>::tint(const
    color_type&)

The code:

    #include <concepts>

    concept Color<typename T> {
        int tint(T); // #1
        int& tint(T&); // #2
    }
    struct color {
        int m_tint;
        color() : m_tint(0) {}

        int tint() const { return m_tint; } // #1
        int& tint() { return m_tint; } // #2
    };
    concept_map Color<color> {
        int tint(const color& c) { return c.tint(); } // #1
        int& tint(color& c) { return c.tint(); } // #2
    }

    template<Color color_type>
    int Action(const color_type& color) {
        return tint(color); // should choose overload #1 since #2
    requires a non-const argument
    }

    int main() {
        return Action(color());
    }

I took a look through the reported tickets and didn't see anything that
appeared to be a match for this. If this is not a known issue, please
let me know and I'll open a ticket for it.

Tom.