This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] (regression) Set TREE_CONSTANT for STATIC_EXPR andCAST_EXPR
On Thu, 2003-06-19 at 17:36, Gabriel Dos Reis wrote:
> Mark Mitchell <mark@codesourcery.com> writes:
>
> | On Wed, 2003-06-18 at 12:20, Gabriel Dos Reis wrote:
> | > Jason Merrill <jason@redhat.com> writes:
> | >
> | > | Hmm, it seems odd to me that we would be analyzing whether or not an
> | > | expression is a constant-expression when parsing a template, since we can't
> | > | always tell.
> | >
> | > Completly agreed. Those semantics restrictions should be checked only
> | > at full instantiation points.
> |
> | Au contraire!
> |
> | They can be checked whenever we want to check them, and early is good.
>
> In processing
>
> template<class Q>
> struct X {
> typedef typename Q::T T;
> static const T a = Q::a;
> };
>
> there is no way of knowing whether Q::a is a valid initializer.
Yes -- and that's why I liked the patch that checked for dependency.
It's not the fact that we're in a template that makes it impossible to
check; it's the fact that's a dependent expression.
--
Mark Mitchell <mark@codesourcery.com>
CodeSourcery, LLC