]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
DR 1584 PR c++/57466
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 9 Jul 2014 21:23:06 +0000 (21:23 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 9 Jul 2014 21:23:06 +0000 (21:23 +0000)
/cp
2014-07-09  Paolo Carlini  <paolo.carlini@oracle.com>

DR 1584
PR c++/57466
* pt.c (check_cv_quals_for_unify): Implement resolution, disregard
cv-qualifiers of function types.

/testsuite
2014-07-09  Paolo Carlini  <paolo.carlini@oracle.com>

DR 1584
PR c++/57466
* g++.dg/template/pr57466.C: New.
* g++.dg/cpp0x/pr57466.C: Likewise.
* g++.dg/template/unify6.C: Update.

From-SVN: r212410

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr57466.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/pr57466.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/unify6.C

index f1832ce407dbef4284bda6ddd917b8c94ef86fde..6174193cb89577312d4845722bd1f88f5c56277c 100644 (file)
@@ -1,3 +1,10 @@
+2014-07-09  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       DR 1584
+       PR c++/57466
+       * pt.c (check_cv_quals_for_unify): Implement resolution, disregard
+       cv-qualifiers of function types.
+
 2014-07-09  Andrew Sutton  <andrew.n.sutton@gmail.com>
            Paolo Carlini  <paolo.carlini@oracle.com>
 
index 7bbbf0301ff606ecc3d4e271701f2bd8caeff969..7b79280da1ab8c1be516007a8f4213ee744fc885 100644 (file)
@@ -17189,6 +17189,11 @@ 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);
 
+  /* DR 1584: cv-qualification of a deduced function type is
+     ignored; see 8.3.5 [dcl.fct].  */
+  if (TREE_CODE (arg) == FUNCTION_TYPE)
+    return 1;
+
   if (TREE_CODE (parm) == TEMPLATE_TYPE_PARM
       && !(strict & UNIFY_ALLOW_OUTER_MORE_CV_QUAL))
     {
index e4cd3bc637471e5de81e9b8433a86721fcd2b75c..675e3431b10b69d85465ee4e1a250585fad82b47 100644 (file)
@@ -1,3 +1,11 @@
+2014-07-09  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       DR 1584
+       PR c++/57466
+       * g++.dg/template/pr57466.C: New.
+       * g++.dg/cpp0x/pr57466.C: Likewise.
+       * g++.dg/template/unify6.C: Update.
+
 2014-07-09  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        * gfortran.dg/ieee/underflow_1.f90: New file.
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr57466.C b/gcc/testsuite/g++.dg/cpp0x/pr57466.C
new file mode 100644 (file)
index 0000000..792a3cb
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/57466
+// { dg-do compile { target c++11 } }
+
+template<typename T>
+  constexpr bool
+  is_pointer(const T*)
+  { return true; }
+
+template<typename T>
+  constexpr bool
+  is_pointer(const T&)
+  { return false; }
+
+using F = void();
+
+constexpr F* f = nullptr;
+
+static_assert( is_pointer(f), "function pointer is a pointer" );
diff --git a/gcc/testsuite/g++.dg/template/pr57466.C b/gcc/testsuite/g++.dg/template/pr57466.C
new file mode 100644 (file)
index 0000000..6dd3710
--- /dev/null
@@ -0,0 +1,8 @@
+// DR 1584, PR c++/57466
+
+template<class T> void f2(const T*);
+void g2();
+
+void m() {
+  f2(g2);    // OK: cv-qualification of deduced function type ignored
+}
index 551c96ebb9fedc8915164f6fa7c70db8c64d2b67..374bb91c216f51a95eaa77dd75c1e76d93d563df 100644 (file)
@@ -3,21 +3,20 @@
 
 void Baz ();
 
-template <typename T> void Foo1 (T *); // #1
-template <typename T> void Foo1 (T const *a) {a (1);} // #2
+template <typename T> void Foo1 (T *);
+template <typename T> void Foo1 (T const *a) {a (1);} // { dg-error "too many arguments" }
 
 template <typename T> T const *Foo2 (T *);
 
-template <typename T> void Foo3 (T *, T const * = 0); // { dg-message "note" }
+template <typename T> void Foo3 (T *, T const * = 0);
 
 void Bar ()
 {
-  Foo1 (&Baz); // #1
+  Foo1 (&Baz); // { dg-message "required from here" }
 
   Foo2 (&Baz);
 
   Foo3 (&Baz);
 
-  Foo3 (&Baz, &Baz); // { dg-error "no matching function" "" }
-  // { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 21 }
+  Foo3 (&Baz, &Baz);
 }