Bug 26068 - [4.0 Regression] extern "C" static function should not be allowed
Summary: [4.0 Regression] extern "C" static function should not be allowed
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.2
: P2 normal
Target Milestone: 4.1.2
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid, monitored
: 33078 44717 (view as bug list)
Depends on:
Blocks: 27884
  Show dependency treegraph
 
Reported: 2006-02-02 00:19 UTC by Patrick Rabau
Modified: 2010-06-29 18:23 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.0.4 2.95.3 4.1.2 4.2.0
Known to fail: 3.2.3 3.3.3 3.4.0 4.0.0 4.1.0 4.1.1
Last reconfirmed: 2006-09-03 21:40:02


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Rabau 2006-02-02 00:19:01 UTC
Acccording to C++ standard 7.5/7 "A linkage-specification directly containing a single declaration shall not specify a storage class."  They also give the following example as invalid:

extern "C" static void foo();

But g++ version 4.0.2 accepts this.
Comment 1 Andrew Pinski 2006-02-02 00:23:56 UTC
Confirmed, a regression from 3.0.4:
t.cc:1: multiple storage classes in declaration of `foo'
Comment 2 Mark Mitchell 2006-02-24 00:26:53 UTC
This issue will not be resolved in GCC 4.1.0; retargeted at GCC 4.1.1.
Comment 3 Mark Mitchell 2006-05-17 17:24:11 UTC
Subject: Bug 26068

Author: mmitchel
Date: Wed May 17 17:24:00 2006
New Revision: 113869

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113869
Log:
	PR c++/26068
	* parser.c (cp_parser_set_storage_class): Check for 
	invalid uses of storage classes on unbraced linkage
	specifications.
	(cp_parser_decl_specifier_seq): Pass keywords, not storage classes,
	to cp_parser_set_storage_class.
	PR c++/26068
	* g++.dg/opt/pr17697-3.C: Remove invalid extern specifier.
	* g++.dg/parse/linkage1.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/parse/linkage1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/opt/pr17697-3.C

Comment 4 Mark Mitchell 2006-05-17 17:27:25 UTC
Fixed in 4.2.
Comment 5 Mark Mitchell 2006-05-25 02:33:51 UTC
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
Comment 6 Mark Mitchell 2006-05-31 02:56:00 UTC
Subject: Bug 26068

Author: mmitchel
Date: Wed May 31 02:55:52 2006
New Revision: 114261

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114261
Log:
	PR c++/26068
	* parser.c (cp_parser_set_storage_class): Check for 
	invalid uses of storage classes on unbraced linkage
	specifications.
	(cp_parser_decl_specifier_seq): Pass keywords, not storage classes,
	to cp_parser_set_storage_class.
	PR c++/26068
	* g++.dg/opt/pr17697-3.C: Remove invalid extern specifier.
	* g++.dg/parse/linkage1.C: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/parse/linkage1.C
Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/parser.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/opt/pr17697-3.C

Comment 7 Mark Mitchell 2006-05-31 02:56:45 UTC
Fixed in 4.1.2.
Comment 8 Volker Reichelt 2007-02-03 21:05:19 UTC
Won't be fixed o the 4.0 branch.
Fixed in GCC 4.1.2.
Comment 9 Andrew Pinski 2007-08-15 16:40:31 UTC
*** Bug 33078 has been marked as a duplicate of this bug. ***
Comment 10 Andrew Pinski 2010-06-29 18:23:03 UTC
*** Bug 44717 has been marked as a duplicate of this bug. ***