This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [C++] value-dependent expressions and static_cast
Gabriel Dos Reis <gdr@integrable-solutions.net> wrote:
>> What does exactly "value-dependent" expression mean, as implemented by
>> pt.c:value_dependent_expression_p()?
>
> See standard description at 14.6.2.3.
Sorry, I didn't realize it was an "official" terminology.
>> I can't fully make it out and it does
>> not seem very well documented in the comments. My understanding is that
it
>> means "an expression whose value depends on a template paramter and thus
>> cannot be fully simplified before instantiation". Is this correct?
>
> Nearly but not exactly.
Then, is there way to paraphrase the rationale behind this "value-dependent"
concept?
>> Also, given a template parameter T and auto T t[2], is &t[1] a
>> value-dependent expression?
>
> No.
I assume because "&t[1]" is not a constant expression in a first place. If
"T t[2]" had static storage duration, it would be value-dependent, right?
Giovanni Bajo