re PR c++/78765 (ICE on invalid C++ code on x86_64-linux-gnu (internal compiler error...
authorNathan Sidwell <nathan@acm.org>
Thu, 5 Jan 2017 12:30:26 +0000 (12:30 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Thu, 5 Jan 2017 12:30:26 +0000 (12:30 +0000)
cp/
PR c++/78765
* pt.c (convert_nontype_argument): Don't try and see if integral
or enum expressions are constants prematurely.

testsuite/
PR c++/78765
* g++.dg/cpp0x/pr78765.C: New.

From-SVN: r244101

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

index 8e723be..35f0a22 100644 (file)
@@ -1,3 +1,9 @@
+2017-01-05  Nathan Sidwell  <nathan@acm.org>
+
+       PR c++/78765
+       * pt.c (convert_nontype_argument): Don't try and see if integral
+       or enum expressions are constants prematurely.
+
 2017-01-04  Marek Polacek  <polacek@redhat.com>
 
        PR c++/64767
index 51c3c57..366c59a 100644 (file)
@@ -6386,7 +6386,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
           to leave it in that form rather than lower it to a
           CONSTRUCTOR.  */;
       else if (INTEGRAL_OR_ENUMERATION_TYPE_P (type))
-       expr = maybe_constant_value (expr);
+       /* Constant value checking is done later with type conversion.  */;
       else if (cxx_dialect >= cxx1z)
        {
          if (TREE_CODE (type) != REFERENCE_TYPE)
index 86dee20..aa6dc34 100644 (file)
@@ -1,3 +1,8 @@
+2017-01-05  Nathan Sidwell  <nathan@acm.org>
+
+       PR c++/78765
+       * g++.dg/cpp0x/pr78765.C: New.
+
 2017-01-05  Dominik Vogt  <vogt@linux.vnet.ibm.com>
 
        * gcc.target/s390/memcpy-2.c: New test.
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr78765.C b/gcc/testsuite/g++.dg/cpp0x/pr78765.C
new file mode 100644 (file)
index 0000000..6b66d26
--- /dev/null
@@ -0,0 +1,15 @@
+// PR c++/78765
+// { dg-do compile { target c++11 } }
+
+// ICE with failed constexpr object and member fn call
+
+struct ValueType {
+  constexpr operator int() const {return field;}
+  int field;
+};
+
+static constexpr ValueType var = 0; // { dg-error "conversion" }
+
+template <int> class ValueTypeInfo;
+
+ValueTypeInfo<var> x;