This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/67427] New: [concepts] Subsumption dependence on template parameter ordering
- From: "Casey at Carter dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 01 Sep 2015 18:27:57 +0000
- Subject: [Bug c++/67427] New: [concepts] Subsumption dependence on template parameter ordering
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67427
Bug ID: 67427
Summary: [concepts] Subsumption dependence on template
parameter ordering
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: Casey at Carter dot net
Target Milestone: ---
r227376 fails to compile this correct program with -std=gnu++1z:
template <class S, class I>
concept bool Sentinel =
requires (I i) { i; };
Sentinel{S, I}
void distance(I first, S last) {}
template <class I, class S>
concept bool SizedIteratorRange =
Sentinel<S, I> && true;
#if FOO
template <class S, class I>
#else
template <class I, class S>
#endif
requires SizedIteratorRange<I, S>
void distance(I first, S last) {}
int main() {
distance(42, 43);
}
with error:
~/gcc6-r227376/bin/g++ -std=gnu++1z ~/foo4.cpp -c
/home/casey/foo4.cpp: In function âint main()â:
/home/casey/foo4.cpp:21:18: error: call of overloaded âdistance(int, int)â is
ambiguous
distance(42, 43);
^
/home/casey/foo4.cpp:6:6: note: candidate: void distance(I, S) [with S = int; I
= int]
void distance(I first, S last) {}
^
/home/casey/foo4.cpp:18:6: note: candidate: void distance(I, S) [with I = int;
S = int]
void distance(I first, S last) {}
^
It does compile successfully when FOO is defined to 1, changing the declaration
order of the template parameters on the second overload of distance.