* semantics.c (maybe_constant_value): Don't try to fold { }.
* pt.c (build_non_dependent_expr): Don't wrap { }.
* init.c (build_value_init): Allow scalar value-init in templates.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@178012
138bc75d-0d04-0410-961f-
82ee72b054a4
+2011-08-23 Jason Merrill <jason@redhat.com>
+
+ PR c++/50024
+ * semantics.c (maybe_constant_value): Don't try to fold { }.
+ * pt.c (build_non_dependent_expr): Don't wrap { }.
+ * init.c (build_value_init): Allow scalar value-init in templates.
+
2011-08-23 Jakub Jelinek <jakub@redhat.com>
PR c++/46862
constructor. */
/* The AGGR_INIT_EXPR tweaking below breaks in templates. */
- gcc_assert (!processing_template_decl);
+ gcc_assert (!processing_template_decl || SCALAR_TYPE_P (type));
if (CLASS_TYPE_P (type))
{
if (TREE_CODE (expr) == THROW_EXPR)
return expr;
+ /* Don't wrap an initializer list, we need to be able to look inside. */
+ if (BRACE_ENCLOSED_INITIALIZER_P (expr))
+ return expr;
+
if (TREE_CODE (expr) == COND_EXPR)
return build3 (COND_EXPR,
TREE_TYPE (expr),
if (type_dependent_expression_p (t)
|| type_unknown_p (t)
+ || BRACE_ENCLOSED_INITIALIZER_P (t)
|| !potential_constant_expression (t)
|| value_dependent_expression_p (t))
return t;
+2011-08-23 Jason Merrill <jason@redhat.com>
+
+ PR c++/50024
+ * g++.dg/cpp0x/constexpr-initlist5.C: New.
+
2011-08-23 Jakub Jelinek <jakub@redhat.com>
PR c++/46862
--- /dev/null
+// PR c++/50024
+// { dg-options -std=c++0x }
+
+template< class T >
+struct Container
+{
+ Container(){
+ int* ptr = new int{};
+ }
+};
+
+int main() {
+ Container< int > c;
+}
+