Assume that the following code is legal code that compiles properly, that T
is a type name, and that x
is the name of a variable.
Syntax one:
T a(x);
Syntax two:
T a = x;
Do the exact semantics of these two expressions ever differ? If so, under what circumstances?
If these two expressions ever do have different semantics I'm also really curious about which part of the standard talks about this.
Also, if there is a special case when T is the name of a scalar type (aka, int
, long
, double
, etc...), what are the differences when T is a scalar type vs. a non-scalar type?
From 8.5.14 (emphasis mine):
So, whether they're equivalent is left to the implementation.
8.5.11 is also relevant, but only in confirming that there can be a difference: