I believe this part of the standard is relevant [basic.scope.class] /1.1 :
The potential scope of the name declared in the class consists not only of the declarative region following the names of the points of declaration, but also of all function bodies, default arguments, exception specification s, as well as parentheses or equal initializers of non-static data in this class ( including such things in nested classes).
Note that it only mentions the default arguments. Thus, this works as decltype is referenced in the default argument:
Method(QSharedPointer<int> info1 = decltype(info2)())
And this also works, since inside the body:
Method(<...>) { decltype(info2) info3; }
However, your example does not work, because such a placement of the decltype object does not apply to the paragraph I have given, so the name info2 is considered out of scope.
source share