re PR c++/48745 ([C++0x] Segmentation fault with list-initialization, void initialize...
authorJason Merrill <jason@redhat.com>
Wed, 11 May 2011 21:29:35 +0000 (17:29 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 11 May 2011 21:29:35 +0000 (17:29 -0400)
PR c++/48745
* pt.c (value_dependent_expr_p): Handle CONSTRUCTOR.

From-SVN: r173678

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

index 6a27cbb36b8fbe310ea2bba0ab2977cb6781dfbc..fe1ccb57e4840f193e013e0da596a021d559000d 100644 (file)
@@ -1,3 +1,8 @@
+2011-05-11  Jason Merrill  <jason@redhat.com>
+
+       PR c++/48745
+       * pt.c (value_dependent_expr_p): Handle CONSTRUCTOR.
+
 2011-05-11  Nathan Froyd  <froydnj@codesourcery.com>
 
        * cp-tree.h (TYPENAME_TYPE_FULLNAME, TYPEOF_TYPE_EXPR): Use
index 5e2497796fd11aed0a511647393fb8c32fbf767c..74d4cbf1eddef85c7f32981a933a918c8c4e889a 100644 (file)
@@ -18273,6 +18273,16 @@ value_dependent_expression_p (tree expression)
         type-dependent.  */
       return type_dependent_expression_p (expression);
 
+    case CONSTRUCTOR:
+      {
+       unsigned ix;
+       tree val;
+       FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (expression), ix, val)
+         if (value_dependent_expression_p (val))
+           return true;
+       return false;
+      }
+
     default:
       /* A constant expression is value-dependent if any subexpression is
         value-dependent.  */
index 79919a2c5ce0d7cce615465d0fcbf5b3ad3283c8..51aacc5fddbdb2cf2c6d7ce1e9b48199de402922 100644 (file)
@@ -1,3 +1,7 @@
+2011-05-11  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/cpp0x/sfinae22.C: New.
+
 2011-05-11  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/48889
diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae22.C b/gcc/testsuite/g++.dg/cpp0x/sfinae22.C
new file mode 100644 (file)
index 0000000..1c3efd2
--- /dev/null
@@ -0,0 +1,23 @@
+// PR c++/48745
+// { dg-options -std=c++0x }
+
+template<class T>
+struct add_rval_ref {
+  typedef T&& type;
+};
+
+template<>
+struct add_rval_ref<void> {
+  typedef void type;
+};
+
+template<class T>
+typename add_rval_ref<T>::type create();
+
+template<class T, class... Args>
+decltype(T{create<Args>()...}, char()) f(int);
+
+template<class, class...>
+char (&f(...))[2];
+
+static_assert(sizeof(f<int, void>(0)) != 1, "Error"); // #