[C++ Patch] PR 53624
Paolo Carlini
paolo.carlini@oracle.com
Tue Jul 31 00:50:00 GMT 2012
On 07/31/2012 12:42 AM, Jason Merrill wrote:
> On 07/30/2012 06:26 PM, Paolo Carlini wrote:
>> + if ((cxx_dialect == cxx98)
>> + || (TREE_CODE (decl) != FUNCTION_DECL && is_primary))
>
> We shouldn't do this check for non-primary templates in C++98 mode,
> either.
Yes. Thus the below also passes testing.
Thanks,
Paolo.
///////////////////////
-------------- next part --------------
Index: testsuite/g++.dg/cpp0x/temp_default5.C
===================================================================
--- testsuite/g++.dg/cpp0x/temp_default5.C (revision 0)
+++ testsuite/g++.dg/cpp0x/temp_default5.C (revision 0)
@@ -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 = [] () {};
+}
Index: cp/pt.c
===================================================================
--- cp/pt.c (revision 189981)
+++ cp/pt.c (working copy)
@@ -4267,7 +4267,8 @@ check_default_tmpl_args (tree decl, tree parms, in
/* 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, in
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. */
More information about the Gcc-patches
mailing list