This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++ bug 57
- From: Martin Sebor <sebor at roguewave dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: Nathan Sidwell <nathan at codesourcery dot com>, "gcc-bugs at gcc dot gnu dot org" <gcc-bugs at gcc dot gnu dot org>, "jason at redhat dot com" <jason at redhat dot com>
- Date: Wed, 21 Nov 2001 12:14:03 -0700
- Subject: Re: c++ bug 57
- Organization: Rogue Wave Software, Inc.
- References: <38010000.1006362452@gandalf.codesourcery.com>
[Get raw message]
Mark Mitchell wrote:
>
> --On Wednesday, November 21, 2001 10:22:52 AM +0000 Nathan Sidwell
> <nathan@codesourcery.com> wrote:
>
> struct B {
> void foo (int = A<T,U>::n);
> template <class T, class U> struct A { static const int n;};
> };
>
> This should be invalid. The standard should say specifically that the
> default argument expression is taken to be the next sequence of tokens
> up to an unnested `,', where nested means nested within parentheses,
> braces, or square brackets.
I'm not sure I'm quite following this discussion. The above snippet
is, IMHO, clearly ill-formed for at least two reasons:
1. T and U are not defined at the point of declaration of foo.
2. A is not in scope at the point of declaration of foo.
This is ill-formed only due to (2):
template <class V, class W>
struct B {
void foo (int = A<V, W>::n);
template <class T, class U> struct A { static const int n;};
};
But this is well-formed:
template <class V, class W>
struct B {
template <class T, class U> struct A { static const int n;};
void foo (int = A<V, W>::n);
};
Regards
Martin