Created attachment 36077 [details] Preprocessed test case r226205 fails to compile this correct program: #include <stl2/iterator.hpp> template <stl2::WeakOutputIterator<int> I> requires !stl2::WeakInputIterator<I>() constexpr bool dispatch() { return false; } template <stl2::WeakInputIterator I> constexpr bool dispatch() { return true; } template <stl2::WeakOutputIterator<int> I> constexpr bool is_weak_out() { return true; } template <stl2::WeakInputIterator I> constexpr bool is_weak_in() { return true; } int main() { static_assert(is_weak_out<int*>()); static_assert(is_weak_in<int*>()); static_assert(dispatch<int*>()); } with error: ~/concept-gcc/bin/g++ -std=gnu++1z -I ~/cmcstl2/include -I ~/cmcstl2/meta/include foo.cpp -c foo.cpp: In function ‘int main()’: foo.cpp:19:32: error: call of overloaded ‘dispatch()’ is ambiguous static_assert(dispatch<int*>()); ^ foo.cpp:5:16: note: candidate: constexpr bool dispatch() [with I = int*] constexpr bool dispatch() { return false; } ^ foo.cpp:8:16: note: candidate: constexpr bool dispatch() [with I = int*] constexpr bool dispatch() { return true; } ^ The compiler apparently considers both overloads of dispatch to be viable despite that the first overload's constraint !stl2::WeakInputIterator<I>() is clearly not satisfied when I is int*.
Fixed.
Author: jason Date: Thu Jul 30 03:29:00 2015 New Revision: 226380 URL: https://gcc.gnu.org/viewcvs?rev=226380&root=gcc&view=rev Log: PR c++/67038 * constraint.cc (satisfy_constraint): Use dummy args if null. Added: branches/c++-concepts/gcc/testsuite/g++.dg/concepts/req18.C Modified: branches/c++-concepts/ChangeLog.concepts branches/c++-concepts/gcc/cp/constraint.cc