]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/53624 (GCC rejects function local types in template function with default...
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 31 Jul 2012 09:46:46 +0000 (09:46 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 31 Jul 2012 09:46:46 +0000 (09:46 +0000)
/cp
2012-07-31  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/53624
* pt.c (check_default_tmpl_args): Don't check local types.

/testsuite
2012-07-31  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/53624
* g++.dg/cpp0x/temp_default5.C: New.

From-SVN: r190001

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

index 2d87bdc3e8219c6ce2c01997b43b1ed918ab203b..86041697d1821ed8cbbb33e06004537272c87d22 100644 (file)
@@ -1,8 +1,12 @@
+2012-07-31  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/53624
+       * pt.c (check_default_tmpl_args): Don't check local types.
+
 2012-07-25  Sandra Loosemore  <sandra@codesourcery.com>
            Paul Brook  <paul@codesourcery.com>
 
        PR target/53633
-
        * decl.c (finish_function): Check targetm.warn_func_return.
 
 2012-07-25  Jason Merrill  <jason@redhat.com>
index 07b294f36eeb9f95fcb37b4e4fcb42b83acc6022..31ae3efb0120dbb3d62635e2a8552061103dc6ee 100644 (file)
@@ -4267,7 +4267,8 @@ check_default_tmpl_args (tree decl, tree parms, int is_primary,
 
   /* Core issue 226 (C++0x only): the following only applies to class
      templates.  */
-  if ((cxx_dialect == cxx98) || TREE_CODE (decl) != FUNCTION_DECL)
+  if (is_primary
+      && ((cxx_dialect == cxx98) || TREE_CODE (decl) != FUNCTION_DECL))
     {
       /* [temp.param]
 
@@ -4299,8 +4300,7 @@ check_default_tmpl_args (tree decl, tree parms, int is_primary,
                   TREE_PURPOSE (parm) = error_mark_node;
                   no_errors = false;
                 }
-             else if (is_primary
-                      && !is_partial
+             else if (!is_partial
                       && !is_friend_decl
                       /* Don't complain about an enclosing partial
                          specialization.  */
index 1ee69471d29ad2b097a721d337c4946c52d5c9ae..2802689c361b4b6a638e664a2d391e037756fb34 100644 (file)
@@ -1,3 +1,8 @@
+2012-07-31  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/53624
+       * g++.dg/cpp0x/temp_default5.C: New.
+
 2012-07-30  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/51081
diff --git a/gcc/testsuite/g++.dg/cpp0x/temp_default5.C b/gcc/testsuite/g++.dg/cpp0x/temp_default5.C
new file mode 100644 (file)
index 0000000..21ad5fb
--- /dev/null
@@ -0,0 +1,13 @@
+// { dg-options "-std=c++11" }
+
+template <class Z = void, class T>
+void Foo(T)
+{
+  struct X {};
+}
+
+template <class T = int, typename U>
+void f(const U&)
+{
+  auto g = [] () {};
+}