This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++ bug 57
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Martin Sebor <sebor at roguewave 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 11:17:31 -0800
- Subject: Re: c++ bug 57
[Get raw message]
--On Wednesday, November 21, 2001 12:14:03 PM -0700 Martin Sebor
<sebor@roguewave.com> wrote:
> 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);
> };
I agree on all points.
However, the standard doesn't seem to be entirely clear about it.
Nathan is going to raise these points with the committee, I believe.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com