[PATCH] D15174: [MSVC] Fix for http://llvm.org/PR25636: indexed accessor property not supported correctly.

John McCall via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 6 22:14:48 PST 2015


rjmccall added inline comments.

================
Comment at: lib/Sema/SemaPseudoObject.cpp:464
@@ -461,1 +463,3 @@
+  if (useSetterResultAsExprResult(result.get()))
+    setResultToLastSemantic();
 
----------------
Sure, but that's not what I'm saying.  I'm saying that the code, as you've written it, will use the value passed to the setter (if capturable) as the result of the expression if it can't capture the setter result.

That is, given:

  struct A {
    __declspec(property(get=GetX,put=PutX)) int x;
    int GetX() const { return 0; }
    void SetX(long y) {}
  };

this expression will have type long instead of void, because it's implicitly falling back on capturing the value passed to the setter:

  a.x = 5;

I suspect that that's not the MSVC semantics, and the language rule is that you should always use the setter result.  If that's true, you should be asking the subclass which rule to use abstractly, i.e. before constructing the setter, and then (1) suppressing the capture of the set value and (2) using the setter result (if capturable) or else nothing.


http://reviews.llvm.org/D15174





More information about the cfe-commits mailing list