This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++] enumerators and check_initializer
- From: Gabriel Dos Reis <gdr at cs dot tamu dot edu>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 15 Jan 2006 14:18:28 -0600
- Subject: Re: [C++] enumerators and check_initializer
- References: <87psmtpeu0.fsf@soliton.cs.tamu.edu> <43CA908D.2080107@codesourcery.com>
Mark Mitchell <mark@codesourcery.com> writes:
| Gabriel Dos Reis wrote:
| > Hi,
| >
| > We have the following code in decl.c:check_initializer():
| >
| >
| > if (TREE_CODE (decl) == CONST_DECL)
| > {
| > gcc_assert (TREE_CODE (decl) != REFERENCE_TYPE);
| >
| > DECL_INITIAL (decl) = init;
| >
| > gcc_assert (init != NULL_TREE);
| > init = NULL_TREE;
| > }
| >
| >
| > If decl is a CONST_DECL, then obviously the assert
| >
| > gcc_assert (TREE_CODE (decl) != REFERENCE_TYPE);
| >
| > is trivially true. Is it a typo for
| >
| > gcc_assert (TREE_CODE (TREE_TYPE (decl)) != REFERENCE_TYPE);
| >
| > where one wanted to check that the decl is not a reference type?
|
| Yes.
Fixed with this. Thanks!
-- Gaby
2006-01-15 Gabriel Dos Reis <gdr@integrable-solutions.net>
* decl.c (check_initializer): Fix thinko.
*** decl.c (revision 109730)
--- decl.c (local)
*************** check_initializer (tree decl, tree init,
*** 4578,4584 ****
if (TREE_CODE (decl) == CONST_DECL)
{
! gcc_assert (TREE_CODE (decl) != REFERENCE_TYPE);
DECL_INITIAL (decl) = init;
--- 4578,4584 ----
if (TREE_CODE (decl) == CONST_DECL)
{
! gcc_assert (TREE_CODE (type) != REFERENCE_TYPE);
DECL_INITIAL (decl) = init;