public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/37877]  New: Invalid "invalid use of static" error
@ 2008-10-20 13:29 jfc at mit dot edu
  2008-12-24 14:19 ` [Bug c++/37877] [4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: jfc at mit dot edu @ 2008-10-20 13:29 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1923 bytes --]

I believe this is valid C++:

extern "C++" struct S { static int x; } s;

g++ 4.2.4, 4.3.1, and the Debian version of 4.3.2 reject the declaration with
the error:

static.cpp:1: error: invalid use of ‘static’ in linkage specification

I don't think static members of structures were intended to be disallowed by
the prohibition duplicate storage classes in declarations like

extern "lang" static int x;

This seems to fix the problem:

===================================================================
--- gcc/gcc/cp/parser.c (revision 5135)
+++ gcc/gcc/cp/parser.c (revision 5136)
@@ -13423,6 +13423,7 @@
   bool nested_name_specifier_p;
   unsigned saved_num_template_parameter_lists;
   bool saved_in_function_body;
+  bool saved_in_unbraced_linkage_specification_p;
   tree old_scope = NULL_TREE;
   tree scope = NULL_TREE;
   tree bases;
@@ -13475,6 +13476,10 @@
   /* We are not in a function body.  */
   saved_in_function_body = parser->in_function_body;
   parser->in_function_body = false;
+  /* We are not immediately inside an extern "lang" block */
+  saved_in_unbraced_linkage_specification_p
+    = parser->in_unbraced_linkage_specification_p;
+  parser->in_unbraced_linkage_specification_p = false;

   /* Start the class.  */
   if (nested_name_specifier_p)
@@ -13587,6 +13592,8 @@
   parser->in_function_body = saved_in_function_body;
   parser->num_template_parameter_lists
     = saved_num_template_parameter_lists;
+  parser->in_unbraced_linkage_specification_p
+    = saved_in_unbraced_linkage_specification_p;

   return type;
 }


-- 
           Summary: Invalid "invalid use of static" error
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jfc at mit dot edu


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


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

* [Bug c++/37877] [4.3/4.4 Regression] Invalid "invalid use of static" error
  2008-10-20 13:29 [Bug c++/37877] New: Invalid "invalid use of static" error jfc at mit dot edu
@ 2008-12-24 14:19 ` pinskia at gcc dot gnu dot org
  2008-12-29 21:29 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-24 14:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-12-24 14:17 -------
Confirmed, a regression from at least 4.1.1, I have not tried 4.2.x yet.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |rejects-valid
      Known to fail|                            |4.3.0 4.4.0
      Known to work|                            |4.0.1 4.1.1
   Last reconfirmed|0000-00-00 00:00:00         |2008-12-24 14:17:11
               date|                            |
            Summary|Invalid "invalid use of     |[4.3/4.4 Regression] Invalid
                   |static" error               |"invalid use of static"
                   |                            |error
   Target Milestone|---                         |4.3.3


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


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

* [Bug c++/37877] [4.3/4.4 Regression] Invalid "invalid use of static" error
  2008-10-20 13:29 [Bug c++/37877] New: Invalid "invalid use of static" error jfc at mit dot edu
  2008-12-24 14:19 ` [Bug c++/37877] [4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
@ 2008-12-29 21:29 ` rguenth at gcc dot gnu dot org
  2008-12-30 11:08 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-12-29 21:29 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
           Priority|P3                          |P2


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


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

* [Bug c++/37877] [4.3/4.4 Regression] Invalid "invalid use of static" error
  2008-10-20 13:29 [Bug c++/37877] New: Invalid "invalid use of static" error jfc at mit dot edu
  2008-12-24 14:19 ` [Bug c++/37877] [4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
  2008-12-29 21:29 ` rguenth at gcc dot gnu dot org
@ 2008-12-30 11:08 ` jakub at gcc dot gnu dot org
  2009-01-09 14:46 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-12-30 11:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2008-12-30 11:07 -------
The patch looks good to me.  Have you (or could you if not) posted it to
gcc-patches for review?


-- 


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


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

* [Bug c++/37877] [4.3/4.4 Regression] Invalid "invalid use of static" error
  2008-10-20 13:29 [Bug c++/37877] New: Invalid "invalid use of static" error jfc at mit dot edu
                   ` (2 preceding siblings ...)
  2008-12-30 11:08 ` jakub at gcc dot gnu dot org
@ 2009-01-09 14:46 ` jakub at gcc dot gnu dot org
  2009-01-09 14:47 ` [Bug c++/37877] [4.3 " jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-01-09 14:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2009-01-09 14:45 -------
Subject: Bug 37877

Author: jakub
Date: Fri Jan  9 14:45:44 2009
New Revision: 143206

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143206
Log:
        PR c++/37877
        * parser.c (cp_parser_class_specifier): Clear
        parser->in_unbraced_linkage_specification_p while parsing class
        specifiers.

        * g++.dg/parse/linkage3.C: New test.

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


-- 


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


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

* [Bug c++/37877] [4.3 Regression] Invalid "invalid use of static" error
  2008-10-20 13:29 [Bug c++/37877] New: Invalid "invalid use of static" error jfc at mit dot edu
                   ` (3 preceding siblings ...)
  2009-01-09 14:46 ` jakub at gcc dot gnu dot org
@ 2009-01-09 14:47 ` jakub at gcc dot gnu dot org
  2009-01-24 10:27 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-01-09 14:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2009-01-09 14:46 -------
Fixed on the trunk so far.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|4.3.0 4.4.0                 |4.3.0
      Known to work|4.0.1 4.1.1                 |4.0.1 4.1.1 4.4.0
            Summary|[4.3/4.4 Regression] Invalid|[4.3 Regression] Invalid
                   |"invalid use of static"     |"invalid use of static"
                   |error                       |error


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


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

* [Bug c++/37877] [4.3 Regression] Invalid "invalid use of static" error
  2008-10-20 13:29 [Bug c++/37877] New: Invalid "invalid use of static" error jfc at mit dot edu
                   ` (4 preceding siblings ...)
  2009-01-09 14:47 ` [Bug c++/37877] [4.3 " jakub at gcc dot gnu dot org
@ 2009-01-24 10:27 ` rguenth at gcc dot gnu dot org
  2009-07-10 15:57 ` rguenth at gcc dot gnu dot org
  2009-07-10 16:04 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-24 10:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2009-01-24 10:20 -------
GCC 4.3.3 is being released, adjusting target milestone.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.3.3                       |4.3.4


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


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

* [Bug c++/37877] [4.3 Regression] Invalid "invalid use of static" error
  2008-10-20 13:29 [Bug c++/37877] New: Invalid "invalid use of static" error jfc at mit dot edu
                   ` (5 preceding siblings ...)
  2009-01-24 10:27 ` rguenth at gcc dot gnu dot org
@ 2009-07-10 15:57 ` rguenth at gcc dot gnu dot org
  2009-07-10 16:04 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-10 15:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2009-07-10 15:57 -------
Subject: Bug 37877

Author: rguenth
Date: Fri Jul 10 15:56:52 2009
New Revision: 149485

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149485
Log:
2009-07-10  Richard Guenther  <rguenther@suse.de>

        Backport from mainline
        2009-01-09  John F. Carr  <jfc@mit.edu>

        PR c++/37877
        * parser.c (cp_parser_class_specifier): Clear
        parser->in_unbraced_linkage_specification_p while parsing class
        specifiers.

        * g++.dg/parse/linkage3.C: New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/g++.dg/parse/linkage3.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=37877


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

* [Bug c++/37877] [4.3 Regression] Invalid "invalid use of static" error
  2008-10-20 13:29 [Bug c++/37877] New: Invalid "invalid use of static" error jfc at mit dot edu
                   ` (6 preceding siblings ...)
  2009-07-10 15:57 ` rguenth at gcc dot gnu dot org
@ 2009-07-10 16:04 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-10 16:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2009-07-10 16:03 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|4.3.0                       |4.3.0 4.3.3
      Known to work|4.0.1 4.1.1 4.4.0           |4.0.1 4.1.1 4.3.4 4.4.0
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2009-07-10 16:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-20 13:29 [Bug c++/37877] New: Invalid "invalid use of static" error jfc at mit dot edu
2008-12-24 14:19 ` [Bug c++/37877] [4.3/4.4 Regression] " pinskia at gcc dot gnu dot org
2008-12-29 21:29 ` rguenth at gcc dot gnu dot org
2008-12-30 11:08 ` jakub at gcc dot gnu dot org
2009-01-09 14:46 ` jakub at gcc dot gnu dot org
2009-01-09 14:47 ` [Bug c++/37877] [4.3 " jakub at gcc dot gnu dot org
2009-01-24 10:27 ` rguenth at gcc dot gnu dot org
2009-07-10 15:57 ` rguenth at gcc dot gnu dot org
2009-07-10 16:04 ` rguenth 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).