public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/8338: Koenig lookup doesn't work for enum
@ 2002-10-24 7:06 dv
0 siblings, 0 replies; only message in thread
From: dv @ 2002-10-24 7:06 UTC (permalink / raw)
To: gcc-gnats
>Number: 8338
>Category: c++
>Synopsis: Koenig lookup doesn't find enum value in special case
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Thu Oct 24 07:06:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Detlef Vollmann
>Release: 3.3 20021023 (experimental)
>Organization:
vollmann engineering gmbh
>Environment:
System: Linux dwarf 2.4.3-XFS #7 Mon Aug 6 18:43:20 CEST 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /pdsrc/gcc/cvs/gcc/configure --program-suffix=-test --prefix=/local/gcc-test --enable-shared --enable-threads=posix --enable-version-specific-runtime-libs --enable-languages=c,c++
>Description:
See attached code.
I consider the code as legal, though Alias is still an incomplete type.
That this is a lookup problem can be seen when the initialiser 'max'
is fully specified as 'N1::max'.
>How-To-Repeat:
See attached code.
>Fix:
// Problematic code:
namespace N1
{
enum E { max = 5 };
} // N1
namespace N2
{
template <class EnumType, class OtherType>
class A
{
public:
int f(int i) { return table[i]; }
private:
static const EnumType size = max;
int table[size];
};
template <class T>
struct B
{
// empty
};
} // N2
namespace N1
{
struct C;
typedef N2::B<C> Alias;
struct C
{
N2::A<E, Alias> a;
};
} // N1
using namespace N1;
using namespace N2;
int main()
{
C c;
return c.a.f(3);
}
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-10-24 14:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-24 7:06 c++/8338: Koenig lookup doesn't work for enum dv
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).