The following code, while invalid, causes g++ >= 4.0.0 to hang while compiling. Please note that "i" is also undeclared. GCC 3.4.4 errors out as expected. class TestClass { public: int m_z; }; class WrapperClass { public: TestClass m_test; }; int main() { WrapperClass wrapper0(TestClass(i)); return wrapper0().m_test.m_z++; }
(In reply to comment #0) > Please note that "i" is also undeclared. Err, i is not a variable.... so ignore that statement. I am assuming gcc is treating the "WrapperClass wrapper0(TestClass(i));" as a declaration instead of instantiation. Still, the compiler should not hang.
I don't get a hang but I do get an ICE after some errors. Confirmed.
This is a relatively low priority regression; we get valid errors before the crash.
Here's a simpler testcase with only one error: ======================= struct A { int i; }; A foo(int); void bar() { foo().i; } =======================
This issue will not be resolved in GCC 4.1.0; retargeted at GCC 4.1.1.
Mark, are you really working on this one or did you only accidentally assign the PR to you? The following fixes the problem for me and allows to get rid of error_mark_list as it is then unused: =================================================================== --- gcc/gcc/cp/typeck.c 2006-04-18 17:32:06 +0200 +++ gcc/gcc/cp/typeck.c 2006-04-18 17:32:31 +0200 @@ -2788,7 +2788,7 @@ convert_arguments (tree typelist, tree v } else error ("too few arguments to function"); - return error_mark_list; + return error_mark_node; } } ===================================================================
Subject: Re: [4.0/4.1/4.2 Regression] Treating a class object as a function with member variables causes hang reichelt at gcc dot gnu dot org wrote: > ------- Comment #6 from reichelt at gcc dot gnu dot org 2006-04-19 09:34 ------- > Mark, > are you really working on this one or did you only accidentally assign the PR > to > you? Well, I planned to fix it before the next release, but I wasn't actually doing anything on it. You're always welcome to fix my bugs. :-) > The following fixes the problem for me and allows to get rid of > error_mark_list as it is then unused: > > =================================================================== > --- gcc/gcc/cp/typeck.c 2006-04-18 17:32:06 +0200 > +++ gcc/gcc/cp/typeck.c 2006-04-18 17:32:31 +0200 > @@ -2788,7 +2788,7 @@ convert_arguments (tree typelist, tree v > } > else > error ("too few arguments to function"); > - return error_mark_list; > + return error_mark_node; > } > } I can't argue with that. :-) This patch, and the removal of error_mark_list are fine. Thanks,
Subject: Bug 26036 Author: reichelt Date: Wed Apr 19 17:36:59 2006 New Revision: 113087 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113087 Log: PR c++/26036 * typeck.c (convert_arguments): Return error_mark_node instead of error_mark_list. * cp-tree.h (error_mark_list): Remove declaration. * decl.c (error_mark_list): Remove definition. (cxx_init_decl_processing): Do not initialize error_mark_list. * g++.dg/expr/call3.C: New test. Added: trunk/gcc/testsuite/g++.dg/expr/call3.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-tree.h trunk/gcc/cp/decl.c trunk/gcc/cp/typeck.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 26036 Author: reichelt Date: Wed Apr 19 17:40:27 2006 New Revision: 113088 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113088 Log: PR c++/26036 * typeck.c (convert_arguments): Return error_mark_node instead of error_mark_list. * cp-tree.h (error_mark_list): Remove declaration. * decl.c (error_mark_list): Remove definition. (cxx_init_decl_processing): Do not initialize error_mark_list. * g++.dg/expr/call3.C: New test. Added: branches/gcc-4_1-branch/gcc/testsuite/g++.dg/expr/call3.C Modified: branches/gcc-4_1-branch/gcc/cp/ChangeLog branches/gcc-4_1-branch/gcc/cp/cp-tree.h branches/gcc-4_1-branch/gcc/cp/decl.c branches/gcc-4_1-branch/gcc/cp/typeck.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
Subject: Bug 26036 Author: reichelt Date: Wed Apr 19 17:43:01 2006 New Revision: 113089 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113089 Log: PR c++/26036 * typeck.c (convert_arguments): Return error_mark_node instead of error_mark_list. * cp-tree.h (error_mark_list): Remove declaration. * decl.c (error_mark_list): Remove definition. (cxx_init_decl_processing): Do not initialize error_mark_list. * g++.dg/expr/call3.C: New test. Added: branches/gcc-4_0-branch/gcc/testsuite/g++.dg/expr/call3.C Modified: branches/gcc-4_0-branch/gcc/cp/ChangeLog branches/gcc-4_0-branch/gcc/cp/cp-tree.h branches/gcc-4_0-branch/gcc/cp/decl.c branches/gcc-4_0-branch/gcc/cp/typeck.c branches/gcc-4_0-branch/gcc/testsuite/ChangeLog
Fixed on mainline, 4.1 branch, and 4.0 branch.
Subject: Bug number PR c++/26036 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-04/msg00711.html