<div dir="ltr">Hi there,<div><br></div><div>The following code only produces thread safety warnings for me in get_foo_copy, not get_foo_reference. Is this expected? Sorry if this is a FAQ / known issue.</div><div><br></div><div><div>$ clang --version</div><div>Apple LLVM version 7.0.2 (clang-700.1.81)</div><div>Target: x86_64-apple-darwin15.3.0</div><div>Thread model: posix</div></div><div><br></div><div>The problem also seems present on clang 3.8.0:</div><div><a href="https://godbolt.org/g/37DqNy">https://godbolt.org/g/37DqNy</a><br></div><div><br></div><div>Best,</div><div>RJ</div><div><br></div><div>(with the usual thread annotation definitions)</div><div><br></div><div><div>class CAPABILITY("mutex") Mutex {</div><div>  public:</div><div>    Mutex() {}</div><div>    inline void lock() ACQUIRE() {}</div><div>    inline void unlock() RELEASE() {}</div><div>};</div><div><br></div><div>class Foo {</div><div>  public:</div><div>    int& get_foo_reference() {</div><div>        return foo_;</div><div>    }</div><div><br></div><div>    int get_foo_copy() {</div><div>        return foo_;</div><div>    }</div><div><br></div><div>  private:</div><div>    Mutex foo_lock_;</div><div>    int foo_ GUARDED_BY(foo_lock_);</div><div>};</div></div><div><br></div></div>