A trivial patch to fix an ICE on invalid: DECL_BUILT_IN only expects
a FUNCTION_DECL, so checking DECL_P is not enough.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2016-03-01  Marek Polacek  <pola...@redhat.com>

        PR c++/69795
        * c-common.c (reject_gcc_builtin): Check for FUNCTION_DECL rather than
        any DECL.

        * g++.dg/parse/invalid1.C: New test.

diff --git gcc/c-family/c-common.c gcc/c-family/c-common.c
index 71da6e9..22ea7da 100644
--- gcc/c-family/c-common.c
+++ gcc/c-family/c-common.c
@@ -12638,7 +12638,7 @@ reject_gcc_builtin (const_tree expr, location_t loc /* 
= UNKNOWN_LOCATION */)
 
   if (TREE_TYPE (expr)
       && TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE
-      && DECL_P (expr)
+      && TREE_CODE (expr) == FUNCTION_DECL
       /* The intersection of DECL_BUILT_IN and DECL_IS_BUILTIN avoids
         false positives for user-declared built-ins such as abs or
         strlen, and for C++ operators new and delete.
diff --git gcc/testsuite/g++.dg/parse/invalid1.C 
gcc/testsuite/g++.dg/parse/invalid1.C
index e69de29..f72e277 100644
--- gcc/testsuite/g++.dg/parse/invalid1.C
+++ gcc/testsuite/g++.dg/parse/invalid1.C
@@ -0,0 +1,5 @@
+// PR c++/69795
+// { dg-do compile { target c++11 } }
+// { dg-options "-w" }
+
+int foo ( foo += *[ // { dg-error "" }

        Marek

Reply via email to