re PR c++/84596 (internal compiler error: unexpected expression '(bool)c' of kind...
authorMarek Polacek <polacek@redhat.com>
Wed, 14 Mar 2018 06:14:57 +0000 (06:14 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 14 Mar 2018 06:14:57 +0000 (06:14 +0000)
PR c++/84596
* semantics.c (finish_static_assert): Check
instantiation_dependent_expression_p instead of
{type,value}_dependent_expression_p.

* g++.dg/cpp0x/static_assert15.C: New test.

From-SVN: r258513

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/static_assert15.C [new file with mode: 0644]

index 71fba7518072238a785e3dd4080500da7d856d5d..067d53835b668d392013b318b29ecb4f4bf996cf 100644 (file)
@@ -1,3 +1,10 @@
+2018-03-14  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/84596
+       * semantics.c (finish_static_assert): Check
+       instantiation_dependent_expression_p instead of
+       {type,value}_dependent_expression_p.
+
 2018-03-13  Paolo Carlini  <paolo.carlini@oracle.com>
            Jason Merrill  <jason@redhat.com>
 
index bb8b5953539ef1a64f8049ea037e0632362bc0ee..fdf37bea770eeba97e35fbc0b1914d73470ebfdc 100644 (file)
@@ -8630,8 +8630,7 @@ finish_static_assert (tree condition, tree message, location_t location,
   if (check_for_bare_parameter_packs (condition))
     condition = error_mark_node;
 
-  if (type_dependent_expression_p (condition) 
-      || value_dependent_expression_p (condition))
+  if (instantiation_dependent_expression_p (condition))
     {
       /* We're in a template; build a STATIC_ASSERT and put it in
          the right place. */
index bc31ea6a1140570cdb09c1a777f7805a7875d459..a4bf53c8bc45c8ada628bfff80a78ed2b0b7e587 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-14  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/84596
+       * g++.dg/cpp0x/static_assert15.C: New test.
+
 2018-03-13  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/61775
diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert15.C b/gcc/testsuite/g++.dg/cpp0x/static_assert15.C
new file mode 100644 (file)
index 0000000..a740f73
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/84596
+// { dg-do compile { target c++11 } }
+
+template<int x>
+struct a {
+  constexpr void b() {
+    int c;
+    static_assert(c %= 1, "");
+  }
+};