re PR c++/79435 (ICE on invalid C++ code (with member access into an incomplete type...
authorMarek Polacek <polacek@redhat.com>
Fri, 10 Feb 2017 16:32:19 +0000 (16:32 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Fri, 10 Feb 2017 16:32:19 +0000 (16:32 +0000)
PR c++/79435
* pt.c (type_dependent_expression_p): Check if the expression type
is null.

* g++.dg/cpp1y/pr79435.C: New.

From-SVN: r245334

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

index 0c5d1654bad9fae2a58f4ec3325e650bf8952562..7f113ecf4903dbba49759500f11c2adb2276c2ba 100644 (file)
@@ -1,3 +1,9 @@
+2017-02-10  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/79435
+       * pt.c (type_dependent_expression_p): Check if the expression type
+       is null.
+
 2017-02-10  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/71737
index c23c14c9e38b7b37153e5eefb6cc64be7ab4aaa4..712fb6919031ba43cb72c8c3c91e417e94e4e0e2 100644 (file)
@@ -23818,6 +23818,7 @@ type_dependent_expression_p (tree expression)
      we couldn't determine its length in cp_complete_array_type because
      it is dependent.  */
   if (VAR_P (expression)
+      && TREE_TYPE (expression) != NULL_TREE
       && TREE_CODE (TREE_TYPE (expression)) == ARRAY_TYPE
       && !TYPE_DOMAIN (TREE_TYPE (expression))
       && DECL_INITIAL (expression))
index a1cee1b28126a360fb24e2bf9bf6a2e07088e084..0c17a0362deb84e1016c691b39510fb01d60ad9e 100644 (file)
@@ -1,3 +1,8 @@
+2017-02-10  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/79435
+       * g++.dg/cpp1y/pr79435.C: New.
+
 2017-02-10  Christophe Lyon  <christophe.lyon@linaro.org>
 
        * gcc.target/aarch64/advsimd-intrinsics/p64_p128.c
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr79435.C b/gcc/testsuite/g++.dg/cpp1y/pr79435.C
new file mode 100644 (file)
index 0000000..a9e4671
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/79435
+// { dg-do compile { target c++14 } }
+
+struct A;
+extern A a; // { dg-error "'a' has incomplete type" }
+template < int > int f = a.x;