This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/67860] [concepts] bug with overloaded, refined function with explicit and variadic template arguments


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67860

Christian Butcher <chrisb2244 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chrisb2244 at gmail dot com

--- Comment #1 from Christian Butcher <chrisb2244 at gmail dot com> ---
A (I hope) similar (and perhaps simpler) code producing this result is

###############################################
#include <algorithm>

template <typename T, typename... U>
concept bool AreType() {
    return (std::is_same<T,U>::value && ...);
    // return true; gives the same overloaded error
}

// Function with constraint
template<typename T, AreType<T>... U>
bool isValid(U... u) {
    return true;
}

// Function with no constraint
template<typename T, typename... U>
bool isValid(U... u) {
    return false;
}

int main() {
    isValid<int>(1); // also isValid<int>(1, 2, 3); etc
}

###############################################


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]