This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]