re PR c++/50391 ([C++0x] ICE on invalid code, pair with incomplete type)
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 14 Sep 2011 16:19:59 +0000 (16:19 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 14 Sep 2011 16:19:59 +0000 (16:19 +0000)
/cp
2011-09-14  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/50391
* pt.c (regenerate_decl_from_template): Don't pass an error_mark_node
to build_exception_variant.

/testsuite
2011-09-14  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/50391
* g++.dg/cpp0x/noexcept15.C: New.

From-SVN: r178857

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

index aa4a31d1ca472f183c788484f0678ef720b17933..8b15ca663c98f690355f5c189b49c3168b068f99 100644 (file)
@@ -1,3 +1,9 @@
+2011-09-14  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/50391
+       * pt.c (regenerate_decl_from_template): Don't pass an error_mark_node
+       to build_exception_variant.
+
 2011-09-13  Dodji Seketeli  <dodji@redhat.com>
 
        PR c++/48320
index 14073646a73df242fea12e7e5157d21edbdea8cf..ee33daf1fb9d578982745e9ac5d61ac426b9276d 100644 (file)
@@ -17729,7 +17729,7 @@ regenerate_decl_from_template (tree decl, tree tmpl)
       specs = tsubst_exception_specification (TREE_TYPE (code_pattern),
                                              args, tf_error, NULL_TREE,
                                              /*defer_ok*/false);
-      if (specs)
+      if (specs && specs != error_mark_node)
        TREE_TYPE (decl) = build_exception_variant (TREE_TYPE (decl),
                                                    specs);
 
index 3aa10de4853133c2414e534d60afd2f15e8ef5a4..28d1102b18d8c7ff6660778f5198bc762fc9e1e2 100644 (file)
@@ -1,3 +1,8 @@
+2011-09-14  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/50391
+       * g++.dg/cpp0x/noexcept15.C: New.
+
 2011-09-14  Tom de Vries  <tom@codesourcery.com>
 
        PR middle-end/50251
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept15.C b/gcc/testsuite/g++.dg/cpp0x/noexcept15.C
new file mode 100644 (file)
index 0000000..5e8c40c
--- /dev/null
@@ -0,0 +1,34 @@
+// PR c++/50391
+// { dg-options -std=c++0x }
+
+#include <type_traits>
+
+template<class Tp>
+  struct single
+  {
+    Tp elem;  // { dg-error "incomplete type" }
+
+    constexpr single(const Tp& e)
+    : elem(e) { }   // { dg-error "invalid field" }
+
+    single(single&& s) // { dg-error "not a member" }
+    noexcept(std::is_nothrow_move_constructible<Tp>::value) 
+    : elem(s.elem) { } // { dg-error "invalid field|no member" }
+  };
+
+template<class Tp>
+  constexpr single<typename std::decay<Tp>::type>
+  make_single(Tp&& x)
+  {
+    return single<typename std::decay<Tp>::type>(x);
+  }
+
+class Blob;  // { dg-error "forward declaration" }
+
+void
+foo(Blob *b)
+{
+  make_single(*b);
+}
+
+// { dg-prune-output "include" }