Bug 33494 - [4.1 regression] Broken diagnostic: 'modop_expr' not supported by dump_expr
Summary: [4.1 regression] Broken diagnostic: 'modop_expr' not supported by dump_expr
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P4 normal
Target Milestone: 4.2.3
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic, monitored
Depends on:
Blocks:
 
Reported: 2007-09-19 06:49 UTC by Volker Reichelt
Modified: 2008-07-04 16:14 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.2.3
Known to fail: 4.1.3
Last reconfirmed: 2007-10-29 11:04:45


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2007-09-19 06:49:39 UTC
The C++ frontend generates a broken diagnostic for the following code
snippet since GCC 3.4.0:

==============================================
template<int> void foo(int(*f=0)());
==============================================

bug.cc:1: error: variable or field 'foo' declared void
bug.cc:1: error: 'f' was not declared in this scope
bug.cc:1: error: '(int)(#'modop_expr' not supported by dump_expr#<expression error>)' cannot be used as a function

Another testcase for the unsupported 'modop_expr' is the following:

==============================================
template<int> struct A
{
  int i;
  typeof(A = A()) i;
};
==============================================

bug.cc:2: error: expected primary-expression before '=' token
bug.cc:2: error: declaration of '__typeof__ (#'modop_expr' not supported by dump_expr#<expression error>) A<<anonymous> >::i'
bug.cc:1: error: conflicts with previous declaration 'int A<<anonymous> >::i'
Comment 1 Paolo Carlini 2007-10-29 11:04:45 UTC
On it.
Comment 2 paolo@gcc.gnu.org 2007-11-01 02:17:16 UTC
Subject: Bug 33494

Author: paolo
Date: Thu Nov  1 02:17:02 2007
New Revision: 129815

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129815
Log:
/cp
2007-10-31  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33494
	* cxx-pretty-print.c (pp_cxx_typeid_expression,
	pp_cxx_delete_expression): Change to static linkage.
	* cxx-pretty-print.h: Adjust declarations.
	* error.c (dump_expr, case EXPR_PACK_EXPANSION, TYPEID_EXPR,
	MEMBER_REF, DOTSTAR_EXPR, DELETE_EXPR, VEC_DELETE_EXPR,
	MODOP_EXPR): Forward to pp_expression.

	* cxx-pretty-print.c (pp_cxx_expression, case NON_DEPENDENT_EXPR):
	Fix typo.

/testsuite
2007-10-31  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33494
	* g++.dg/template/error35.C: New.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cxx-pretty-print.c
    trunk/gcc/cp/cxx-pretty-print.h
    trunk/gcc/cp/error.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 paolo@gcc.gnu.org 2007-11-01 02:18:54 UTC
Subject: Bug 33494

Author: paolo
Date: Thu Nov  1 02:18:44 2007
New Revision: 129816

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129816
Log:
/cp
2007-10-31  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33494
	* cxx-pretty-print.c (pp_cxx_typeid_expression,
	pp_cxx_delete_expression): Change to static linkage.
	* cxx-pretty-print.h: Adjust declarations.
	* error.c (dump_expr, case EXPR_PACK_EXPANSION, TYPEID_EXPR,
	MEMBER_REF, DOTSTAR_EXPR, DELETE_EXPR, VEC_DELETE_EXPR,
	MODOP_EXPR): Forward to pp_expression.

	* cxx-pretty-print.c (pp_cxx_expression, case NON_DEPENDENT_EXPR):
	Fix typo.

/testsuite
2007-10-31  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33494
	* g++.dg/template/error35.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/template/error35.C

Comment 4 Paolo Carlini 2007-11-01 02:19:56 UTC
Fixed in mainline.
Comment 5 Volker Reichelt 2008-01-02 23:53:27 UTC
Subject: Bug 33494

Author: reichelt
Date: Wed Jan  2 23:52:17 2008
New Revision: 131269

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131269
Log:
	Backport:
	2007-10-31  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33494
	* cxx-pretty-print.c (pp_cxx_typeid_expression,
	pp_cxx_delete_expression): Change to static linkage.
	* cxx-pretty-print.h: Adjust declarations.
	* error.c (dump_expr, case SCOPE_REF, TYPEID_EXPR, DELETE_EXPR,
	VEC_DELETE_EXPR, MODOP_EXPR): Forward to pp_expression.

	* cxx-pretty-print.c (pp_cxx_expression, case NON_DEPENDENT_EXPR):
	Fix typo.

	* g++.dg/template/error35.C: New.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/template/error35.C
Modified:
    branches/gcc-4_2-branch/gcc/cp/ChangeLog
    branches/gcc-4_2-branch/gcc/cp/cxx-pretty-print.c
    branches/gcc-4_2-branch/gcc/cp/cxx-pretty-print.h
    branches/gcc-4_2-branch/gcc/cp/error.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog

Comment 6 Volker Reichelt 2008-01-02 23:56:35 UTC
Now also fixed in GCC 4.2.3.
Comment 7 Joseph S. Myers 2008-07-04 16:14:42 UTC
Closing 4.1 branch.