C++ Logo


Advanced search

Re: [std-proposals] Make typename optional when used with a name dependent on a constrained template

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Wed, 22 Feb 2023 17:03:44 +0200
On Wed, 22 Feb 2023 at 13:30, Christoph Meyer
<christoph.meyer.2006_at_[hidden]> wrote:
> > Well, the concern in (3) isn't about cases where action-at-a-distance
> > makes your code ill-formed. It's about cases where your code
> > continues to compile, but with a different meaning.
> Oh, now I see. This is actually worse than non-compiling code. Although I can't imagine a situation where one would change a type requirement to a value requirement, combined with all of your other ideas, this is a bad idea.

Note that I don't know how likely this problem is to occur, and what
all kinds of scenarios there are where it could trigger. But it
can trigger on Inner::Foo(), where Foo could be either a type or
variable (like, a function object), and if the intention was to call a
the former doesn't really do that. If the intention was to construct a
temporary, the latter doesn't do that.

Anyhoo, the implementation cost concerns are rather severe here. But
for full disclosure, I guesstimate-quantified that only in my head,
I didn't try to figure out the cost of the changes required with an
actual implementation in mind, other than a better-than-just vague
understanding how AST-building compilers work.

Received on 2023-02-22 15:03:58