This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/3478] [3.4 regression] Accepts invalid enum declarations from template class
- From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Sep 2003 21:46:34 -0000
- Subject: [Bug c++/3478] [3.4 regression] Accepts invalid enum declarations from template class
- References: <20010629080601.3478.jthorn@thp.univie.ac.at>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3478
reichelt at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Keywords|rejects-valid |accepts-invalid
Priority|P3 |P1
Resolution|FIXED |
Summary|Rejects code when using enum|[3.4 regression] Accepts
|from template class |invalid enum declarations
| |from template class
Target Milestone|--- |3.4
Version|2.95.2 |3.4
------- Additional Comments From reichelt at gcc dot gnu dot org 2003-09-01 21:46 -------
I reopened the PR for two reasons:
Wolfgang was not quite right and the new parser changed its behavior.
To get it really right this time, here's an updated example (with Mark's help):
-------------------------------------------------------------------------------
template <typename> struct A
{
enum E {};
};
template <typename T> void foo()
{
enum A<void>::E e1; // OK
typename A<T>::E e2; // OK
enum A<T>::E e3; // invalid, A<T>::E is dependent and hence
// [7.1.5.3]/3 cannot be enforced
enum typename A<T>::E e4; // invalid, violates [7.1.5.3]
}
-------------------------------------------------------------------------------
Alas, mainline now accepts all four definitions,
which leaves us with a double accepts-invalid bug.
E4 was correctly rejected before the new parser merge.
E3 was correctly rejected by the new parser until 20030812.
Thus, we have a 3.4 regression in both cases.