Bug 33840 - bit-field size accepted for struct
Summary: bit-field size accepted for struct
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid, monitored, patch
Depends on:
Blocks:
 
Reported: 2007-10-20 21:57 UTC by Volker Reichelt
Modified: 2011-06-04 16:22 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.6.0, 4.7.0
Known to fail:
Last reconfirmed: 2007-11-19 05:46:02


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2007-10-20 21:57:29 UTC
The following invalid code snippet is accepted since at least GCC 2.95.3:

===============================
template<int> struct A
{
  struct {} : 2;
};
===============================
Comment 1 Andrew Pinski 2007-11-19 05:46:02 UTC
Confirmed.
Comment 2 Volker Reichelt 2011-06-04 09:05:30 UTC
This is fixed since GCC 4.6.0, but we should add a testcase before closing the problem report.
Comment 3 Jonathan Wakely 2011-06-04 13:01:30 UTC
patch posted to http://gcc.gnu.org/ml/gcc-patches/2011-06/msg00305.html
Comment 4 Jonathan Wakely 2011-06-04 16:11:47 UTC
Author: redi
Date: Sat Jun  4 16:11:41 2011
New Revision: 174642

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174642
Log:
2011-06-04  Jonathan Wakely  <jwakely.gcc@gmail.com>

	PR c++/33840
	* g++.dg/diagnostic/bitfld2.C: New.


Added:
    trunk/gcc/testsuite/g++.dg/diagnostic/bitfld2.C
Modified:
    trunk/gcc/testsuite/ChangeLog
Comment 5 Jonathan Wakely 2011-06-04 16:21:00 UTC
Author: redi
Date: Sat Jun  4 16:20:55 2011
New Revision: 174645

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174645
Log:
2011-06-04  Jonathan Wakely  <jwakely.gcc@gmail.com>

        PR c++/33840
	* g++.dg/diagnostic/bitfld2.C: New.


Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/diagnostic/bitfld2.C
Modified:
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 6 Jonathan Wakely 2011-06-04 16:22:20 UTC
Thanks, Volker, tests added so closing