re PR c++/62072 (No SFINAE performed for function type)
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 15 Aug 2014 16:23:47 +0000 (16:23 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 15 Aug 2014 16:23:47 +0000 (16:23 +0000)
/cp
2014-08-15  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/62072
Revert:
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-08-15  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/62072
Revert:
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.

* g++.dg/cpp0x/sfinae52.C: New.

From-SVN: r214027

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

index df3811c..6623e96 100644 (file)
@@ -1,3 +1,14 @@
+2014-08-15  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/62072
+       Revert:
+       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-08-15  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
 
        * call.c (build_conditional_expr_1): Use OPT_Wextra in warning.
index 0f391c2..6a7bcb8 100644 (file)
@@ -17284,11 +17284,6 @@ 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 f783027..3f19ce7 100644 (file)
@@ -1,3 +1,17 @@
+2014-08-15  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/62072
+       Revert:
+       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.
+
+       * g++.dg/cpp0x/sfinae52.C: New.
+
 2014-08-15  Ilya Tocar  <tocarip@gmail.com>
 
        PR target/61878
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr57466.C b/gcc/testsuite/g++.dg/cpp0x/pr57466.C
deleted file mode 100644 (file)
index 792a3cb..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// 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/cpp0x/sfinae52.C b/gcc/testsuite/g++.dg/cpp0x/sfinae52.C
new file mode 100644 (file)
index 0000000..f255ee1
--- /dev/null
@@ -0,0 +1,21 @@
+// PR c++/62072
+// { dg-do compile { target c++11 } }
+
+template<typename T> struct tuple_size {};
+template<typename T> struct tuple_size<T const> : tuple_size<T> {};
+
+template<typename T, typename = void>
+struct query {
+    static constexpr bool value = false;
+};
+template<typename T>
+struct query<T, typename tuple_size<T>::type> {
+    static constexpr bool value = true;
+};
+
+// fine
+static_assert( !query<int>::value, "" );
+static_assert( !query<int const>::value, "" );
+
+// error: invalid use of incomplete type 'struct tuple_size<void()>'
+static_assert( !query<void()>::value, "" );
diff --git a/gcc/testsuite/g++.dg/template/pr57466.C b/gcc/testsuite/g++.dg/template/pr57466.C
deleted file mode 100644 (file)
index 6dd3710..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-// 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 374bb91..551c96e 100644 (file)
@@ -3,20 +3,21 @@
 
 void Baz ();
 
-template <typename T> void Foo1 (T *);
-template <typename T> void Foo1 (T const *a) {a (1);} // { dg-error "too many arguments" }
+template <typename T> void Foo1 (T *); // #1
+template <typename T> void Foo1 (T const *a) {a (1);} // #2
 
 template <typename T> T const *Foo2 (T *);
 
-template <typename T> void Foo3 (T *, T const * = 0);
+template <typename T> void Foo3 (T *, T const * = 0); // { dg-message "note" }
 
 void Bar ()
 {
-  Foo1 (&Baz); // { dg-message "required from here" }
+  Foo1 (&Baz); // #1
 
   Foo2 (&Baz);
 
   Foo3 (&Baz);
 
-  Foo3 (&Baz, &Baz);
+  Foo3 (&Baz, &Baz); // { dg-error "no matching function" "" }
+  // { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 21 }
 }