Bug 15862 - [3.4/4.5 Regression] 'enum yn' fails
Summary: [3.4/4.5 Regression] 'enum yn' fails
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 3.4.1
Assignee: Mark Mitchell
Keywords: rejects-valid
: 21713 (view as bug list)
Depends on: 14432
  Show dependency treegraph
Reported: 2004-06-07 22:04 UTC by Joseph Heled
Modified: 2005-05-22 20:43 UTC (History)
3 users (show)

See Also:
Known to work: 3.3.3
Known to fail: 3.4.0 4.0.0
Last reconfirmed: 2004-06-07 22:23:05


Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Heled 2004-06-07 22:04:15 UTC
This short code snippet fails to compile. Worked in 3.3.
As far as I can tell, yn is not a reserved word.

enum yn {Y, N};
enum yn x = Y;

g++ -v -c x.cc
Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.0/specs
Configured with: ../gcc-3.4.0/configure --enable-languafes=c,c++
Thread model: posix
gcc version 3.4.0
 /usr/local/libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1plus -quiet -v -D_GNU_SOURCE
x.cc -quiet -dumpbase x.cc -mtune=pentiumpro -auxbase x -version -o /tmp/cccljUxr.s
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory
#include "..." search starts here:
#include <...> search starts here:
End of search list.
GNU C++ version 3.4.0 (i686-pc-linux-gnu)
	compiled by GNU C version 3.4.0.
GGC heuristics: --param ggc-min-expand=45 --param ggc-min-heapsize=29906
x.cc:2: error: use of enum `yn' without previous declaration
x.cc:2: error: invalid type in declaration before '=' token

$ uname -a
Linux yoda 2.4.18-18.8.0 #1 Wed Nov 13 22:52:09 EST 2002 i686 athlon i386 GNU/Linux
Comment 1 Andrew Pinski 2004-06-07 22:23:02 UTC
Confirmed, a regression.

Mark I feel that this is major parser bug which should be fixed for 3.4.1.
Comment 2 Wolfgang Bangerth 2004-06-07 22:33:10 UTC
No, yn is one of the Bessel function functions in C99 (do 'man yn'). 
The is a duplicate of another bug involving j1, which I'm going to look 
up next. 
Comment 3 Andrew Pinski 2004-06-07 22:38:46 UTC
That would be PR 14432 but since my 3.5.0 build was from last night this is not fixed.
Comment 4 Wolfgang Bangerth 2004-06-07 22:44:50 UTC
Right, I found PR 14432 as well. However, my 3.4 build compiles that one 
correctly, while it still fails on this PR. Mark, do you have an idea what 
is going on? This just seems too close to 14432 to be a coincidence... 
Comment 5 Mark Mitchell 2004-06-09 16:33:30 UTC
Yes, we need to fix this for 3.4.1.
Comment 6 Mark Mitchell 2004-06-10 14:42:25 UTC
Working on a fix.
Comment 7 GCC Commits 2004-06-11 18:14:55 UTC
Subject: Bug 15862

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-06-11 18:14:52

Modified files:
	gcc/cp         : ChangeLog name-lookup.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/parse: enum1.C 

Log message:
	PR c++/15862
	* name-lookup.c (unqualified_namespace_lookup): Do not ignore type
	bindings for undeclared built-ins.
	PR c++/15862
	* g++.dg/parse/enum1.C: New test.


Comment 8 GCC Commits 2004-06-11 18:18:48 UTC
Subject: Bug 15862

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2004-06-11 18:18:46

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog name-lookup.c 
Added files:
	gcc/testsuite/g++.dg/parse: enum1.C 

Log message:
	PR c++/15862
	* name-lookup.c (unqualified_namespace_lookup): Do not ignore type
	bindings for undeclared built-ins.
	PR c++/15862
	* g++.dg/parse/enum1.C: New test.


Comment 9 Mark Mitchell 2004-06-11 18:20:52 UTC
Fixed in GCC 3.4.1.
Comment 10 Andrew Pinski 2005-05-22 20:43:50 UTC
*** Bug 21713 has been marked as a duplicate of this bug. ***