[C++] value-dependent expressions and static_cast

Gabriel Dos Reis gdr@integrable-solutions.net
Wed Jun 18 13:10:00 GMT 2003


"Giovanni Bajo" <giovannibajo@libero.it> writes:

[...]

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

Hmm, I'll try later -- I'm not known to be good at "executive summary" :-)

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

Yes.

-- Gaby



More information about the Gcc mailing list