Remove -fdeduce-init-list.
authorMarek Polacek <polacek@redhat.com>
Wed, 4 Sep 2019 20:10:13 +0000 (20:10 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 4 Sep 2019 20:10:13 +0000 (20:10 +0000)
From-SVN: r275387

gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c.opt
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/pt.c
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/initlist-deduce.C

index be92d37..0f4b61d 100644 (file)
@@ -1,3 +1,7 @@
+2019-09-04  Marek Polacek  <polacek@redhat.com>
+
+       * doc/invoke.texi: Remove -fdeduce-init-list documentation.
+
 2019-09-04  Uroš Bizjak  <ubizjak@gmail.com>
 
        PR target/32413
index ecdaaeb..2720e64 100644 (file)
@@ -1,3 +1,7 @@
+2019-09-04  Marek Polacek  <polacek@redhat.com>
+
+       * c.opt (fdeduce-init-list): Ignored.
+
 2019-09-04  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
 
        PR c/78736
index 38a8e7d..143833d 100644 (file)
@@ -1460,8 +1460,8 @@ C ObjC C++ ObjC++
 Emit debug annotations during preprocessing.
 
 fdeduce-init-list
-C++ ObjC++ Var(flag_deduce_init_list) Init(0)
--fdeduce-init-list     enable deduction of std::initializer_list for a template type parameter from a brace-enclosed initializer-list.
+C++ ObjC++ Ignore
+Does nothing.  Preserved for backward compatibility.
 
 fdeclone-ctor-dtor
 C++ ObjC++ Var(flag_declone_ctor_dtor) Init(-1)
index 8eb81c5..605b3d7 100644 (file)
@@ -1,3 +1,8 @@
+2019-09-04  Marek Polacek  <polacek@redhat.com>
+
+       * call.c (build_over_call): Remove -fdeduce-init-list implementation.
+       * pt.c (unify): Likewise.
+
 2019-09-01  Marek Polacek  <polacek@redhat.com>
 
        PR c++/91129 - wrong error with binary op in template argument.
index 01a25ad..c3045d9 100644 (file)
@@ -8337,38 +8337,6 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
           && !(flags & LOOKUP_EXPLICIT_TMPL_ARGS))
         conversion_warning = false;
 
-      /* Warn about initializer_list deduction that isn't currently in the
-        working draft.  */
-      if (cxx_dialect > cxx98
-         && flag_deduce_init_list
-         && cand->template_decl
-         && is_std_init_list (non_reference (type))
-         && BRACE_ENCLOSED_INITIALIZER_P (arg))
-       {
-         tree tmpl = TI_TEMPLATE (cand->template_decl);
-         tree realparm = chain_index (j, DECL_ARGUMENTS (cand->fn));
-         tree patparm = get_pattern_parm (realparm, tmpl);
-         tree pattype = TREE_TYPE (patparm);
-         if (PACK_EXPANSION_P (pattype))
-           pattype = PACK_EXPANSION_PATTERN (pattype);
-         pattype = non_reference (pattype);
-
-         if (TREE_CODE (pattype) == TEMPLATE_TYPE_PARM
-             && (cand->explicit_targs == NULL_TREE
-                 || (TREE_VEC_LENGTH (cand->explicit_targs)
-                     <= TEMPLATE_TYPE_IDX (pattype))))
-           {
-             pedwarn (input_location, 0, "deducing %qT as %qT",
-                      non_reference (TREE_TYPE (patparm)),
-                      non_reference (type));
-             pedwarn (DECL_SOURCE_LOCATION (cand->fn), 0,
-                      "  in call to %qD", cand->fn);
-             pedwarn (input_location, 0,
-                      "  (you can disable this with "
-                      "%<-fno-deduce-init-list%>)");
-           }
-       }
-
       /* Set user_conv_p on the argument conversions, so rvalue/base handling
         knows not to allow any more UDCs.  This needs to happen after we
         process cand->warnings.  */
index 187f9d8..15cc4b2 100644 (file)
@@ -22073,11 +22073,6 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
       unsigned i;
       tree orig_parm = parm;
 
-      /* Replace T with std::initializer_list<T> for deduction.  */
-      if (TREE_CODE (parm) == TEMPLATE_TYPE_PARM
-         && flag_deduce_init_list)
-       parm = listify (parm);
-
       if (!is_std_init_list (parm)
          && TREE_CODE (parm) != ARRAY_TYPE)
        /* We can only deduce from an initializer list argument if the
index 34d0746..fad19dd 100644 (file)
@@ -2550,28 +2550,6 @@ of a loop too many expressions need to be evaluated, the resulting constexpr
 evaluation might take too long.
 The default is 33554432 (1<<25).
 
-@item -fdeduce-init-list
-@opindex fdeduce-init-list
-Enable deduction of a template type parameter as
-@code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
-
-@smallexample
-template <class T> auto forward(T t) -> decltype (realfn (t))
-@{
-  return realfn (t);
-@}
-
-void f()
-@{
-  forward(@{1,2@}); // call forward<std::initializer_list<int>>
-@}
-@end smallexample
-
-This deduction was implemented as a possible extension to the
-originally proposed semantics for the C++11 standard, but was not part
-of the final standard, so it is disabled by default.  This option is
-deprecated, and may be removed in a future version of G++.
-
 @item -fno-elide-constructors
 @opindex fno-elide-constructors
 @opindex felide-constructors
index 5b6332a..ecde4ca 100644 (file)
@@ -1,3 +1,8 @@
+2019-09-04  Marek Polacek  <polacek@redhat.com>
+
+       * g++.dg/cpp0x/initlist-deduce.C: Don't use -fdeduce-init-list.  Remove
+       dg-warning.  Add dg-error.
+
 2019-09-04  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
 
        PR c/78736
index 6ae32a6..59d98ef 100644 (file)
@@ -1,9 +1,4 @@
-// Test for deduction of T as std::initializer_list.  This isn't currently
-// supported by the working draft, but is necessary for perfect forwarding
-// of initializer-lists to things that can take a std::initializer_list.
-
-// { dg-options "-fdeduce-init-list" }
-// { dg-do run { target c++11 } }
+// { dg-do compile { target c++11 } }
 
 #include <initializer_list>
 
@@ -15,14 +10,13 @@ struct A
 void f (A a) { }
 
 template <class T>
-auto g (T&& t) -> decltype (f(t)) // { dg-warning "call" }
+auto g (T&& t) -> decltype (f(t))
 {
   return f(t);
 }
 
 int main()
 {
-  g({1});                      // { dg-warning "deduc" }
+  g({1});                      // { dg-error "no matching function" }
 }
 
-// { dg-prune-output "-fno-deduce-init-list" }