public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51214] New: [C++11] name lookup issue with c++11 enums
@ 2011-11-18 20:21 fabien at gcc dot gnu.org
2011-11-18 20:33 ` [Bug c++/51214] " fabien at gcc dot gnu.org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: fabien at gcc dot gnu.org @ 2011-11-18 20:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51214
Bug #: 51214
Summary: [C++11] name lookup issue with c++11 enums
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: fabien@gcc.gnu.org
Noticed while working on PR c++/51188, I have launched the c++ testsuite with
the patch below:
Index: class.c
===================================================================
--- class.c (revision 181491)
+++ class.c (working copy)
@@ -6007,7 +6007,7 @@ finish_struct_1 (tree t)
hierarchy), and we want this failure to occur quickly. */
n_fields = count_fields (TYPE_FIELDS (t));
- if (n_fields > 7)
+ if (n_fields > 0)
And it has raised two errors related to c++11 enums: forw_enum5.C and
forw_enum9.C. Thus, here is a reproducer, comming from forw_enum5.C:
// { dg-do compile }
// { dg-options "-std=c++0x" }
namespace one
{
struct S
{
enum { A = 1, B = 2 };
struct T
{
int i1, i2, i3, i4, i5, i6, i7;
enum { B = 102 };
enum class E1;
enum E2 : int;
};
};
static_assert(int(S::T::A1) == 1, "error");
static_assert(int(S::T::B1) == 102, "error");
static_assert(int(S::T::C1) == 103, "error");
}
The following errors are issued:
error: 'A1' is not a member of 'one::S::T'
error: 'B1' is not a member of 'one::S::T'
error: 'C1' is not a member of 'one::S::T'
Most likely an issue in the sorted case of lookup_field_1. Mine.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51214] [C++11] name lookup issue with c++11 enums
2011-11-18 20:21 [Bug c++/51214] New: [C++11] name lookup issue with c++11 enums fabien at gcc dot gnu.org
@ 2011-11-18 20:33 ` fabien at gcc dot gnu.org
2011-12-29 20:56 ` fabien at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: fabien at gcc dot gnu.org @ 2011-11-18 20:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51214
fabien at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2011-11-18
AssignedTo|unassigned at gcc dot |fabien at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51214] [C++11] name lookup issue with c++11 enums
2011-11-18 20:21 [Bug c++/51214] New: [C++11] name lookup issue with c++11 enums fabien at gcc dot gnu.org
2011-11-18 20:33 ` [Bug c++/51214] " fabien at gcc dot gnu.org
@ 2011-12-29 20:56 ` fabien at gcc dot gnu.org
2012-02-28 20:21 ` [Bug c++/51214] [4.7 Regression] " fabien at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: fabien at gcc dot gnu.org @ 2011-12-29 20:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51214
--- Comment #1 from fabien at gcc dot gnu.org 2011-12-29 20:02:15 UTC ---
Here is a correct testcase for this bug.
// { dg-do compile }
// { dg-options "-std=c++0x" }
enum { A = 1 };
struct T
{
int i1, i2, i3, i4, i5, i6, i7;
enum E2 : int;
};
enum T::E2 : int { A1 = A };
int i = T::A1;
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51214] [4.7 Regression] [C++11] name lookup issue with c++11 enums
2011-11-18 20:21 [Bug c++/51214] New: [C++11] name lookup issue with c++11 enums fabien at gcc dot gnu.org
2011-11-18 20:33 ` [Bug c++/51214] " fabien at gcc dot gnu.org
2011-12-29 20:56 ` fabien at gcc dot gnu.org
@ 2012-02-28 20:21 ` fabien at gcc dot gnu.org
2012-04-05 10:56 ` [Bug c++/51214] [4.7/4.8 " rguenth at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: fabien at gcc dot gnu.org @ 2012-02-28 20:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51214
fabien at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[C++11] name lookup issue |[4.7 Regression] [C++11]
|with c++11 enums |name lookup issue with
| |c++11 enums
--- Comment #2 from fabien at gcc dot gnu.org 2012-02-28 20:19:23 UTC ---
We can manage to mark this bug as a 4.7 Regression, evidence below (to be
compiled with -std=c++11 obviously).
struct Base
{
int b1, b2, b3;
};
struct T : Base
{
int t1, t2, t3;
using Base::b1;
using Base::b2;
using Base::b3;
enum E2 : int;
};
enum T::E2 : int { A1 = 23 };
int i = T::A1;
I have a patch for it.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51214] [4.7/4.8 Regression] [C++11] name lookup issue with c++11 enums
2011-11-18 20:21 [Bug c++/51214] New: [C++11] name lookup issue with c++11 enums fabien at gcc dot gnu.org
` (2 preceding siblings ...)
2012-02-28 20:21 ` [Bug c++/51214] [4.7 Regression] " fabien at gcc dot gnu.org
@ 2012-04-05 10:56 ` rguenth at gcc dot gnu.org
2012-04-13 12:54 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-04-05 10:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51214
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.7.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51214] [4.7/4.8 Regression] [C++11] name lookup issue with c++11 enums
2011-11-18 20:21 [Bug c++/51214] New: [C++11] name lookup issue with c++11 enums fabien at gcc dot gnu.org
` (3 preceding siblings ...)
2012-04-05 10:56 ` [Bug c++/51214] [4.7/4.8 " rguenth at gcc dot gnu.org
@ 2012-04-13 12:54 ` rguenth at gcc dot gnu.org
2012-06-07 5:36 ` fabien at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-04-13 12:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51214
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51214] [4.7/4.8 Regression] [C++11] name lookup issue with c++11 enums
2011-11-18 20:21 [Bug c++/51214] New: [C++11] name lookup issue with c++11 enums fabien at gcc dot gnu.org
` (4 preceding siblings ...)
2012-04-13 12:54 ` rguenth at gcc dot gnu.org
@ 2012-06-07 5:36 ` fabien at gcc dot gnu.org
2012-06-07 19:53 ` [Bug c++/51214] [4.7 " jason at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: fabien at gcc dot gnu.org @ 2012-06-07 5:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51214
--- Comment #3 from fabien at gcc dot gnu.org 2012-06-07 05:36:23 UTC ---
Author: fabien
Date: Thu Jun 7 05:36:18 2012
New Revision: 188294
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188294
Log:
gcc/testsuite/ChangeLog
2012-06-07 Fabien Chêne <fabien@gcc.gnu.org>
PR c++/51214
* g++.dg/cpp0x/forw_enum11.C: New.
gcc/cp/ChangeLog
2012-06-07 Fabien Chêne <fabien@gcc.gnu.org>
PR c++/51214
* cp-tree.h (insert_late_enum_def_into_classtype_sorted_fields):
Declare.
* class.c (insert_into_classtype_sorted_fields): New.
(add_enum_fields_to_record_type): New.
(count_fields): Adjust the comment.
(add_fields_to_record_type): Likewise.
(finish_struct_1): Move the code that inserts the fields for the
sorted case, into insert_into_classtype_sorted_fields, and call
it.
(insert_late_enum_def_into_classtype_sorted_fields): Define.
* decl.c (finish_enum_value_list): Call
insert_late_enum_def_into_classtype_sorted_fields if a late enum
definition is encountered.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/forw_enum11.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/class.c
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/decl.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51214] [4.7 Regression] [C++11] name lookup issue with c++11 enums
2011-11-18 20:21 [Bug c++/51214] New: [C++11] name lookup issue with c++11 enums fabien at gcc dot gnu.org
` (5 preceding siblings ...)
2012-06-07 5:36 ` fabien at gcc dot gnu.org
@ 2012-06-07 19:53 ` jason at gcc dot gnu.org
2012-06-14 8:31 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2012-06-07 19:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51214
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.7/4.8 Regression] |[4.7 Regression] [C++11]
|[C++11] name lookup issue |name lookup issue with
|with c++11 enums |c++11 enums
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-07 19:53:40 UTC ---
Fixed on trunk.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51214] [4.7 Regression] [C++11] name lookup issue with c++11 enums
2011-11-18 20:21 [Bug c++/51214] New: [C++11] name lookup issue with c++11 enums fabien at gcc dot gnu.org
` (6 preceding siblings ...)
2012-06-07 19:53 ` [Bug c++/51214] [4.7 " jason at gcc dot gnu.org
@ 2012-06-14 8:31 ` rguenth at gcc dot gnu.org
2012-06-27 17:37 ` fabien at gcc dot gnu.org
2012-06-27 17:53 ` fabien at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-14 8:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51214
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.7.1 |4.7.2
--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-14 08:30:23 UTC ---
GCC 4.7.1 is being released, adjusting target milestone.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51214] [4.7 Regression] [C++11] name lookup issue with c++11 enums
2011-11-18 20:21 [Bug c++/51214] New: [C++11] name lookup issue with c++11 enums fabien at gcc dot gnu.org
` (7 preceding siblings ...)
2012-06-14 8:31 ` rguenth at gcc dot gnu.org
@ 2012-06-27 17:37 ` fabien at gcc dot gnu.org
2012-06-27 17:53 ` fabien at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: fabien at gcc dot gnu.org @ 2012-06-27 17:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51214
--- Comment #6 from fabien at gcc dot gnu.org 2012-06-27 17:36:56 UTC ---
Author: fabien
Date: Wed Jun 27 17:36:50 2012
New Revision: 189021
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189021
Log:
gcc/testsuite/ChangeLog
2012-06-27 Fabien Chêne <fabien@gcc.gnu.org>
PR c++/51214
* g++.dg/cpp0x/forw_enum11.C: New.
gcc/cp/ChangeLog
2012-06-27 Fabien Chêne <fabien@gcc.gnu.org>
PR c++/51214
* cp-tree.h (insert_late_enum_def_into_classtype_sorted_fields):
Declare.
* class.c (insert_into_classtype_sorted_fields): New.
(add_enum_fields_to_record_type): New.
(count_fields): Adjust the comment.
(add_fields_to_record_type): Likewise.
(finish_struct_1): Move the code that inserts the fields for the
sorted case, into insert_into_classtype_sorted_fields, and call
it.
(insert_late_enum_def_into_classtype_sorted_fields): Define.
* decl.c (finish_enum_value_list): Call
insert_late_enum_def_into_classtype_sorted_fields if a late enum
definition is encountered.
Added:
branches/gcc-4_7-branch/gcc/testsuite/g++.dg/cpp0x/forw_enum11.C
Modified:
branches/gcc-4_7-branch/gcc/cp/ChangeLog
branches/gcc-4_7-branch/gcc/cp/class.c
branches/gcc-4_7-branch/gcc/cp/cp-tree.h
branches/gcc-4_7-branch/gcc/cp/decl.c
branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/51214] [4.7 Regression] [C++11] name lookup issue with c++11 enums
2011-11-18 20:21 [Bug c++/51214] New: [C++11] name lookup issue with c++11 enums fabien at gcc dot gnu.org
` (8 preceding siblings ...)
2012-06-27 17:37 ` fabien at gcc dot gnu.org
@ 2012-06-27 17:53 ` fabien at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: fabien at gcc dot gnu.org @ 2012-06-27 17:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51214
fabien at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #7 from fabien at gcc dot gnu.org 2012-06-27 17:53:11 UTC ---
Fixed in 4.7.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-06-27 17:53 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-18 20:21 [Bug c++/51214] New: [C++11] name lookup issue with c++11 enums fabien at gcc dot gnu.org
2011-11-18 20:33 ` [Bug c++/51214] " fabien at gcc dot gnu.org
2011-12-29 20:56 ` fabien at gcc dot gnu.org
2012-02-28 20:21 ` [Bug c++/51214] [4.7 Regression] " fabien at gcc dot gnu.org
2012-04-05 10:56 ` [Bug c++/51214] [4.7/4.8 " rguenth at gcc dot gnu.org
2012-04-13 12:54 ` rguenth at gcc dot gnu.org
2012-06-07 5:36 ` fabien at gcc dot gnu.org
2012-06-07 19:53 ` [Bug c++/51214] [4.7 " jason at gcc dot gnu.org
2012-06-14 8:31 ` rguenth at gcc dot gnu.org
2012-06-27 17:37 ` fabien at gcc dot gnu.org
2012-06-27 17:53 ` fabien at gcc dot gnu.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).