aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2004-04-05 15:52:12 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2004-04-05 15:52:12 +0000
commit355f774decfb49bcf46ce97a6a62a5b89db5e57f (patch)
tree34dac3a2d5c01c3a2b1c8b08d3c06fb571408f8e /gcc
parent30c2010625760849692e4fb21d7166616c138bb5 (diff)
downloadgcc-355f774decfb49bcf46ce97a6a62a5b89db5e57f.zip
gcc-355f774decfb49bcf46ce97a6a62a5b89db5e57f.tar.gz
gcc-355f774decfb49bcf46ce97a6a62a5b89db5e57f.tar.bz2
re PR c++/3518 (default conversion to pointer-to-function is applied to soon (related to DR295))
cp: PR c++/3518 * pt.c (check_cv_quals_for_unify): Ignore bogus CV quals at outer level. testsuite: PR c++/3518 * g++.dg/template/unify7.C: New. From-SVN: r80432
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/unify7.C14
4 files changed, 29 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 515f6fe..d183371 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2004-04-05 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/3518
+ * pt.c (check_cv_quals_for_unify): Ignore bogus CV quals at outer
+ level.
+
2004-04-05 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* init.c (decl_constant_value): Don't look at DECL_INITIAL
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index fd38b0a..ca9a3ca 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -9551,13 +9551,15 @@ check_cv_quals_for_unify (int strict, tree arg, tree parm)
int arg_quals = cp_type_quals (arg);
int parm_quals = cp_type_quals (parm);
- if (TREE_CODE (parm) == TEMPLATE_TYPE_PARM)
+ if (TREE_CODE (parm) == TEMPLATE_TYPE_PARM
+ && !(strict & UNIFY_ALLOW_OUTER_MORE_CV_QUAL))
{
/* Although a CVR qualifier is ignored when being applied to a
substituted template parameter ([8.3.2]/1 for example), that
does not apply during deduction [14.8.2.4]/1, (even though
that is not explicitly mentioned, [14.8.2.4]/9 indicates
- this). */
+ this). Except when we're allowing additional CV qualifiers
+ at the outer level [14.8.2.1]/3,1st bullet. */
if ((TREE_CODE (arg) == REFERENCE_TYPE
|| TREE_CODE (arg) == FUNCTION_TYPE
|| TREE_CODE (arg) == METHOD_TYPE)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 36dcdf2..2d088b6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2004-04-05 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/3518
+ * g++.dg/template/unify7.C: New.
+
2004-04-02 Nathanael Nerode <neroden@gcc.gnu.org>
* g++.dg/README: Bring up to date with new subdirectories; remove
diff --git a/gcc/testsuite/g++.dg/template/unify7.C b/gcc/testsuite/g++.dg/template/unify7.C
new file mode 100644
index 0000000..3f7028b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/unify7.C
@@ -0,0 +1,14 @@
+// Copyright (C) 2004 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 1 Apr 2004 <nathan@codesourcery.com>
+
+// PR c++/3518
+template <typename T> void Foo (const T &);
+template <typename T> void Baz (const T (*)());
+
+int &f ();
+
+int main()
+{
+ Foo (f);
+ Baz (f); // { dg-error "no matching function" "" }
+}