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 71fba75..067d538 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 bb8b595..fdf37be 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 bc31ea6..a4bf53c 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, "");
+  }
+};