aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-03-30 15:39:48 -0400
committerJason Merrill <jason@gcc.gnu.org>2010-03-30 15:39:48 -0400
commitce0ecb98c2297112599b26191d5294187016307c (patch)
treec23097a0549faf770de07458f894f742af64cb36
parent26e020539c3d5bc0831d0443e38a9f0ed37620a7 (diff)
downloadgcc-ce0ecb98c2297112599b26191d5294187016307c.zip
gcc-ce0ecb98c2297112599b26191d5294187016307c.tar.gz
gcc-ce0ecb98c2297112599b26191d5294187016307c.tar.bz2
re PR c++/43559 (Overloaded template functions became ambiguous)
PR c++/43559 * pt.c (more_specialized_fn): Don't control cv-qualifier check with same_type_p. From-SVN: r157831
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/partial7.C10
4 files changed, 23 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d790bfd..eb42b0b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-30 Jason Merrill <jason@redhat.com>
+
+ PR c++/43559
+ * pt.c (more_specialized_fn): Don't control cv-qualifier check
+ with same_type_p.
+
2010-03-26 Jason Merrill <jason@redhat.com>
PR c++/43509
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 3bd45f7..a58dba2 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -15474,13 +15474,10 @@ more_specialized_fn (tree pat1, tree pat2, int len)
than the type from the parameter template (as described above)
that type is considered to be more specialized than the other. If
neither type is more cv-qualified than the other then neither type
- is more specialized than the other."
+ is more specialized than the other." */
- We check same_type_p explicitly because deduction can also succeed
- in both directions when there is a nondeduced context. */
if (deduce1 && deduce2
- && quals1 != quals2 && quals1 >= 0 && quals2 >= 0
- && same_type_p (arg1, arg2))
+ && quals1 != quals2 && quals1 >= 0 && quals2 >= 0)
{
if ((quals1 & quals2) == quals2)
lose2 = true;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 21738c2..ddc9128 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-30 Jason Merrill <jason@redhat.com>
+
+ PR c++/43559
+ * g++.dg/template/partial7.C: New.
+
2010-03-30 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* gcc.target/s390/stackcheck1.c: New testcase.
diff --git a/gcc/testsuite/g++.dg/template/partial7.C b/gcc/testsuite/g++.dg/template/partial7.C
new file mode 100644
index 0000000..0fd157f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/partial7.C
@@ -0,0 +1,10 @@
+// PR c++/43559
+
+template<typename T, typename U> void f(U&) { }
+template<typename T, typename U> void f(T const&) { }
+
+int main()
+{
+ int a;
+ f<int, int const>(a);
+}