public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13927] New: confusing error message on ibad redeclaration of anon union
@ 2004-01-30  6:23 mec dot gnu at mindspring dot com
  2004-01-30 12:22 ` [Bug c++/13927] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: mec dot gnu at mindspring dot com @ 2004-01-30  6:23 UTC (permalink / raw)
  To: gcc-bugs

Consider this ill-formed program:

  int main ()
  {
    union { int alpha; int beta; };
    double alpha;
    return 0;
  }

This is bad because "alpha" is declared twice.

gcc HEAD says:

/berman/fsf/_today_/berman/install/target/native/gcc/gcc-HEAD-as-2.14-ld-2.14/bin/g++
-S au-3.cc
  au-3.cc: In function `int main()':
  au-3.cc:4: error: `double alpha' redeclared as different kind of symbol
  au-3.cc:3: error: previous declaration of `#`alias_decl' not supported by
dump_decl#<declaration error>'
  au-3.cc:4: error: declaration of `double alpha'
  au-3.cc:3: error: conflicts with previous declaration `#`alias_decl' not
supported by dump_decl#<declaration error>'

This doesn't bother me because the line numbers do point to the right place so
that people can get work done.  But it might be nicer if gcc could print a
better error message.

That is, I wouldn't mind a WONTFIX on this one, if fixing it would make the
compiler less elegant.  But I suspect that there is code which doesn't know
about these strange types created by anon union variables so it might be good to
fix this.

For comparison, gcc 3.3.2 prints:

au-3.cc: In function `int main()':
au-3.cc:4: error: conflicting types for `double alpha'
au-3.cc:3: error: previous declaration as `int alpha'

-- 
           Summary: confusing error message on ibad redeclaration of anon
                    union
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mec dot gnu at mindspring dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13927


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-02-20  8:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-30  6:23 [Bug c++/13927] New: confusing error message on ibad redeclaration of anon union mec dot gnu at mindspring dot com
2004-01-30 12:22 ` [Bug c++/13927] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-02-02 19:23 ` [Bug c++/13927] [3.4/3.5 Regression] confusing error message on bad " giovannibajo at libero dot it
2004-02-02 20:43 ` giovannibajo at libero dot it
2004-02-14  2:12 ` cvs-commit at gcc dot gnu dot org
2004-02-14  2:15 ` cvs-commit at gcc dot gnu dot org
2004-02-14  2:17 ` cvs-commit at gcc dot gnu dot org
2004-02-14  2:19 ` cvs-commit at gcc dot gnu dot org
2004-02-14  2:23 ` [Bug c++/13927] [3.4/3.5 Regression] duplicated " giovannibajo at libero dot it
2004-02-20  7:33 ` mmitchel at gcc dot gnu dot org
2004-02-20  8:57 ` cvs-commit at gcc dot gnu dot org
2004-02-20  8:58 ` mmitchel at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).