Patchwork C++ PATCH for c++/56238 (ice-checking with static_cast)

login
register
mail settings
Submitter Jason Merrill
Date March 16, 2013, 6:46 p.m.
Message ID <5144BE23.6070906@redhat.com>
Download mbox | patch
Permalink /patch/228237/
State New
Headers show

Comments

Jason Merrill - March 16, 2013, 6:46 p.m.
On 02/09/2013 03:36 PM, Jason Merrill wrote:
> The code in build_non_dependent_expr has caught a number of issues in
> the compiler; this is another case that fold_non_dependent_expr wasn't
> properly recognizing as dependent.  I think we want to use
> instantiation_dependent there going forward, but for 4.8 I think let's
> just check it in the ENABLE_CHECKING code.

Now that we're in stage 1 again, let's make that change.

Tested x86_64-pc-linux-gnu, applying to trunk.

Patch

commit d76feeb24741fabc5ebbf1d46b8eaf8ac8006b10
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Feb 7 12:49:05 2013 -0500

    	PR c++/56238
    	* pt.c (fold_non_dependent_expr_sfinae): Check
    	instantiation_dependent_expression_p.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 36175ca..6264add 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -5044,9 +5044,8 @@  fold_non_dependent_expr_sfinae (tree expr, tsubst_flags_t complain)
 
      as two declarations of the same function, for example.  */
   if (processing_template_decl
-      && !type_dependent_expression_p (expr)
-      && potential_constant_expression (expr)
-      && !value_dependent_expression_p (expr))
+      && !instantiation_dependent_expression_p (expr)
+      && potential_constant_expression (expr))
     {
       HOST_WIDE_INT saved_processing_template_decl;