+2016-07-15 Jason Merrill <jason@redhat.com>
+
+ PR c++/70824
+ * init.c (constant_value_1): Don't instantiated DECL_INITIAL of
+ artificial variables.
+
2016-07-15 Cesar Philippidis <cesar@codesourcery.com>
* parser.c (cp_parser_oacc_declare): Don't scan for
&& TREE_CODE (init) == TREE_LIST
&& TREE_CHAIN (init) == NULL_TREE)
init = TREE_VALUE (init);
- /* Instantiate a non-dependent initializer. */
- init = instantiate_non_dependent_or_null (init);
+ /* Instantiate a non-dependent initializer for user variables. We
+ mustn't do this for the temporary for an array compound literal;
+ trying to instatiate the initializer will keep creating new
+ temporaries until we crash. Probably it's not useful to do it for
+ other artificial variables, either. */
+ if (!DECL_ARTIFICIAL (decl))
+ init = instantiate_non_dependent_or_null (init);
if (!init
|| !TREE_TYPE (init)
|| !TREE_CONSTANT (init)
--- /dev/null
+// PR c++/70824
+// { dg-do compile { target c++11 } }
+
+#include <initializer_list>
+
+constexpr
+int
+max(std::initializer_list<int> __l)
+{ return *__l.begin(); }
+
+template <class Src>
+void
+a() {
+ const int v = max({1});
+}