OSDN Git Service

PR c++/28878
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 2 Sep 2006 06:54:04 +0000 (06:54 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 2 Sep 2006 06:54:04 +0000 (06:54 +0000)
* except.c (build_throw): Only set current_function_returns_abnormally
if cfun is not NULL.

* g++.dg/parse/crash33.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116655 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/except.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/crash33.C [new file with mode: 0644]

index 5f37dde..4709c14 100644 (file)
@@ -1,5 +1,9 @@
 2006-09-02  Jakub Jelinek  <jakub@redhat.com>
 
 2006-09-02  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/28878
+       * except.c (build_throw): Only set current_function_returns_abnormally
+       if cfun is not NULL.
+
        PR c++/26917
        * repo.c (repo_file): Remove.
        (open_repo_file, reopen_repo_file_for_write): Return fopened
        PR c++/26917
        * repo.c (repo_file): Remove.
        (open_repo_file, reopen_repo_file_for_write): Return fopened
index ad493aa..f97ab06 100644 (file)
@@ -605,7 +605,8 @@ build_throw (tree exp)
 
   if (processing_template_decl)
     {
 
   if (processing_template_decl)
     {
-      current_function_returns_abnormally = 1;
+      if (cfun)
+       current_function_returns_abnormally = 1;
       return build_min (THROW_EXPR, void_type_node, exp);
     }
 
       return build_min (THROW_EXPR, void_type_node, exp);
     }
 
index e4210b8..a8c9b62 100644 (file)
@@ -1,3 +1,8 @@
+2006-09-02  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/28878
+       * g++.dg/parse/crash33.C: New test.
+
 2006-09-01  J"orn Rennecke  <joern.rennecke@st.com>
        Richard Guenther  <rguenther@suse.de>
        Adam Nemet  <anemet@caviumnetworks.com>
 2006-09-01  J"orn Rennecke  <joern.rennecke@st.com>
        Richard Guenther  <rguenther@suse.de>
        Adam Nemet  <anemet@caviumnetworks.com>
diff --git a/gcc/testsuite/g++.dg/parse/crash33.C b/gcc/testsuite/g++.dg/parse/crash33.C
new file mode 100644 (file)
index 0000000..2ab84df
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/28878
+// { dg-do compile }
+
+template<int>
+void foo()
+[
+  throw;       // { dg-error "expected" }
+}              // { dg-error "expected" }