[Bug c++/67969] [concepts] bug with overloaded function when using constraints
kirshamir at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Jan 31 13:07:36 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67969
Amir Kirsh <kirshamir at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kirshamir at gmail dot com
--- Comment #4 from Amir Kirsh <kirshamir at gmail dot com> ---
// Bug still exists in gcc 11.2
template<typename T>
concept SmallVar = (sizeof(T) <= sizeof(int));
void print(SmallVar auto t) {
std::cout << t << std::endl;
}
void print(const auto& t) {
std::cout << t << std::endl;
}
int main() {
static_assert(SmallVar<int>); // ok
static_assert(SmallVar<decltype(6)>); // ok
static_assert(!SmallVar<long long>); // ok
print("hello");
print('a'); // gcc 11.2 sees here ambiguity
print(6); // gcc 11.2 sees here ambiguity
}
Code:
https://godbolt.org/z/jq8edKM3E
More information about the Gcc-bugs
mailing list