diff mbox

[C++] PR 60999

Message ID 5360BF35.2010903@oracle.com
State New
Headers show

Commit Message

Paolo Carlini April 30, 2014, 9:15 a.m. UTC
Hi,

this regression unfortunately has to do with my fix for c++/57887, thus 
the code in maybe_begin_member_template_processing:

    if (nsdmi)
      decl = (CLASSTYPE_TEMPLATE_INFO (DECL_CONTEXT (decl))
          ? CLASSTYPE_TI_TEMPLATE (DECL_CONTEXT (decl))
          : NULL_TREE);

The check is true for the new testcase and we end up with an 
unsubstituted STATIC_CAST_EXPR which leads to an ICE in 
cxx_eval_constant_expression. Having tried a number of ideas (by now we 
have got quite a few testcases in this area), I think it makes sense to 
check uses_template_parms too on DECL_CONTEXT (decl): when it returns 
false I don't think we may run into uses of template parms a la 
c++/57887 and we are back to the status pre- that fix in nsdmi handling.

Tested x86_64-linux.

Thanks,
Paolo.

/////////////////////
/cp
2014-04-30  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/60999
	* pt.c (maybe_begin_member_template_processing): Use
	uses_template_parms.

/testsuite
2014-04-30  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/60999
	* g++.dg/cpp0x/nsdmi-template9.C: New.

Comments

Jason Merrill May 3, 2014, 9:14 p.m. UTC | #1
On 04/30/2014 05:15 AM, Paolo Carlini wrote:
>       decl = (CLASSTYPE_TEMPLATE_INFO (DECL_CONTEXT (decl))
> +	    && uses_template_parms (DECL_CONTEXT (decl))

Do you want CLASSTYPE_IS_TEMPLATE here?

Jason
diff mbox

Patch

Index: cp/pt.c
===================================================================
--- cp/pt.c	(revision 209916)
+++ cp/pt.c	(working copy)
@@ -463,6 +463,7 @@  maybe_begin_member_template_processing (tree decl)
 
   if (nsdmi)
     decl = (CLASSTYPE_TEMPLATE_INFO (DECL_CONTEXT (decl))
+	    && uses_template_parms (DECL_CONTEXT (decl))
 	    ? CLASSTYPE_TI_TEMPLATE (DECL_CONTEXT (decl))
 	    : NULL_TREE);
 
Index: testsuite/g++.dg/cpp0x/nsdmi-template9.C
===================================================================
--- testsuite/g++.dg/cpp0x/nsdmi-template9.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/nsdmi-template9.C	(working copy)
@@ -0,0 +1,16 @@ 
+// PR c++/60999
+// { dg-do compile { target c++11 } }
+
+template <typename A>
+struct foo
+{
+};
+  
+template<>
+struct foo<int>
+{
+  static constexpr int code = 42;
+  unsigned int bar = static_cast<unsigned int>(code);
+};
+  
+foo<int> a;