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 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.

The EDG front end rejects this code, too.

> 	struct C {
> 		static int Foo (int = Baz ());
> 		static int Baz (int = Foo ());
> 	};
>

This should be invalid, too.  The standard should say that you iterate
through the members, in declaration order, after the original class
scan, and fill in default arguments at that time.  Until the default
arguments are filled in, pretend there are none.

This is the algorithm used by the EDG front end, 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]