public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/36999]  New: Erroneous "declaration 'class ...' does not declare anything" warnings possible
@ 2008-08-01 14:13 simon_baldwin at yahoo dot com
  2008-08-04 15:12 ` [Bug c++/36999] " simonb at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: simon_baldwin at yahoo dot com @ 2008-08-01 14:13 UTC (permalink / raw)
  To: gcc-bugs

The following example program produces several unwarranted "declaration ...
does not declare anything" warnings.  This problem is also present in gcc 4.3,
since this is when the warning was introduced.

File /tmp/warning.cc:
class C1 {
 public: class C2 { };
};

void cf1 (class C1::C2, void*);  // Should not provoke a warning
void cf2 (void*, class C1::C2);
void cf3 (C1::C2, void*);

namespace N {

enum E1 { foo };
enum E2 { bar };

template <class X>
class TC1 { };

template <class T, class U>
class TC2 : public TC1<T> { };

}

void
tcf1 (N::TC2<enum N::E1, void*> *arg1,  // Should not provoke a warning
      N::TC2<void*, enum N::E1> *arg2,
      N::TC2<N::E1, void*> *arg3)
{
}

void *
tcf2 (void *x)
{
  return (void *)
    (N::TC2<enum N::E1, void*> *)  // Should not provoke a warning
    (N::TC2<void*, enum N::E1> *)
    (N::TC2<N::E1, void*> *)
    x;
}

/tmp/warning.cc:5: warning: declaration 'class C1::C2' does not declare
anything
/tmp/warning.cc:23: warning: declaration 'enum N::E1' does not declare anything
/tmp/warning.cc: In function 'void* tcf2(void*)':
/tmp/warning.cc:33: warning: declaration 'enum N::E1' does not declare anything


-- 
           Summary: Erroneous "declaration 'class ...' does not declare
                    anything" warnings possible
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: simon_baldwin at yahoo dot com
GCC target triplet: i386-unknown-linux-gnu


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


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

* [Bug c++/36999] Erroneous "declaration 'class ...' does not declare anything" warnings possible
  2008-08-01 14:13 [Bug c++/36999] New: Erroneous "declaration 'class ...' does not declare anything" warnings possible simon_baldwin at yahoo dot com
@ 2008-08-04 15:12 ` simonb at gcc dot gnu dot org
  2008-08-05 23:39 ` manu at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: simonb at gcc dot gnu dot org @ 2008-08-04 15:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from simonb at gcc dot gnu dot org  2008-08-04 15:11 -------
Subject: Bug 36999

Author: simonb
Date: Mon Aug  4 15:09:56 2008
New Revision: 138633

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138633
Log:
        PR c++/36999
        * parser.c (cp_parser_elaborated_type_specifier): Warn only when
        the declaration's id is followed by a semicolon.

        * g++.dg/warn/pr36999.C: New.


Added:
    trunk/gcc/testsuite/g++.dg/warn/pr36999.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/36999] Erroneous "declaration 'class ...' does not declare anything" warnings possible
  2008-08-01 14:13 [Bug c++/36999] New: Erroneous "declaration 'class ...' does not declare anything" warnings possible simon_baldwin at yahoo dot com
  2008-08-04 15:12 ` [Bug c++/36999] " simonb at gcc dot gnu dot org
@ 2008-08-05 23:39 ` manu at gcc dot gnu dot org
  2008-08-06 12:02 ` simon_baldwin at yahoo dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-08-05 23:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2008-08-05 23:38 -------
Simon, is this fixed? If so, you should close it as FIXED.


-- 


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


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

* [Bug c++/36999] Erroneous "declaration 'class ...' does not declare anything" warnings possible
  2008-08-01 14:13 [Bug c++/36999] New: Erroneous "declaration 'class ...' does not declare anything" warnings possible simon_baldwin at yahoo dot com
  2008-08-04 15:12 ` [Bug c++/36999] " simonb at gcc dot gnu dot org
  2008-08-05 23:39 ` manu at gcc dot gnu dot org
@ 2008-08-06 12:02 ` simon_baldwin at yahoo dot com
  2008-08-07 11:24 ` manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: simon_baldwin at yahoo dot com @ 2008-08-06 12:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from simon_baldwin at yahoo dot com  2008-08-06 12:00 -------
Thanks for the note.  Fixed for trunk; I'm currently in the process of
backporting to the 4.3 branch since the bug is there also.


-- 

simon_baldwin at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.4.0 4.3.1 4.3.0


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


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

* [Bug c++/36999] Erroneous "declaration 'class ...' does not declare anything" warnings possible
  2008-08-01 14:13 [Bug c++/36999] New: Erroneous "declaration 'class ...' does not declare anything" warnings possible simon_baldwin at yahoo dot com
                   ` (2 preceding siblings ...)
  2008-08-06 12:02 ` simon_baldwin at yahoo dot com
@ 2008-08-07 11:24 ` manu at gcc dot gnu dot org
  2008-08-07 12:30 ` simonb at gcc dot gnu dot org
  2008-08-07 14:43 ` simon_baldwin at yahoo dot com
  5 siblings, 0 replies; 7+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-08-07 11:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from manu at gcc dot gnu dot org  2008-08-07 11:22 -------
Then this is confirmed and it works in GCC 4.4.0


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to fail|4.4.0 4.3.1 4.3.0           |4.3.1 4.3.0
      Known to work|                            |4.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2008-08-07 11:22:47
               date|                            |


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


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

* [Bug c++/36999] Erroneous "declaration 'class ...' does not declare anything" warnings possible
  2008-08-01 14:13 [Bug c++/36999] New: Erroneous "declaration 'class ...' does not declare anything" warnings possible simon_baldwin at yahoo dot com
                   ` (3 preceding siblings ...)
  2008-08-07 11:24 ` manu at gcc dot gnu dot org
@ 2008-08-07 12:30 ` simonb at gcc dot gnu dot org
  2008-08-07 14:43 ` simon_baldwin at yahoo dot com
  5 siblings, 0 replies; 7+ messages in thread
From: simonb at gcc dot gnu dot org @ 2008-08-07 12:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from simonb at gcc dot gnu dot org  2008-08-07 12:29 -------
Subject: Bug 36999

Author: simonb
Date: Thu Aug  7 12:27:48 2008
New Revision: 138838

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138838
Log:
gcc/cp/ChangeLog:
        Backport from mainline:
        2008-08-04  Simon Baldwin  <simonb@google.com>

        PR c++/36999
        * parser.c (cp_parser_elaborated_type_specifier): Warn only when
        the declaration's id is followed by a semicolon.

gcc/testsuite/ChangeLog:
        Backport from mainline:
        2008-08-04  Simon Baldwin  <simonb@google.com>

        PR c++/36999
        * g++.dg/warn/pr36999.C: New.



Added:
    branches/gcc-4_3-branch/gcc/testsuite/g++.dg/warn/pr36999.C
Modified:
    branches/gcc-4_3-branch/gcc/cp/ChangeLog
    branches/gcc-4_3-branch/gcc/cp/parser.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/36999] Erroneous "declaration 'class ...' does not declare anything" warnings possible
  2008-08-01 14:13 [Bug c++/36999] New: Erroneous "declaration 'class ...' does not declare anything" warnings possible simon_baldwin at yahoo dot com
                   ` (4 preceding siblings ...)
  2008-08-07 12:30 ` simonb at gcc dot gnu dot org
@ 2008-08-07 14:43 ` simon_baldwin at yahoo dot com
  5 siblings, 0 replies; 7+ messages in thread
From: simon_baldwin at yahoo dot com @ 2008-08-07 14:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from simon_baldwin at yahoo dot com  2008-08-07 14:42 -------
Fixed for mainline and 4.3 branch -- resolving as FIXED.


-- 

simon_baldwin at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2008-08-07 14:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-01 14:13 [Bug c++/36999] New: Erroneous "declaration 'class ...' does not declare anything" warnings possible simon_baldwin at yahoo dot com
2008-08-04 15:12 ` [Bug c++/36999] " simonb at gcc dot gnu dot org
2008-08-05 23:39 ` manu at gcc dot gnu dot org
2008-08-06 12:02 ` simon_baldwin at yahoo dot com
2008-08-07 11:24 ` manu at gcc dot gnu dot org
2008-08-07 12:30 ` simonb at gcc dot gnu dot org
2008-08-07 14:43 ` simon_baldwin at yahoo dot com

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).