const auto & var = ObjectWithSideEffects();
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Sema/SemaDecl.cpp | ||
---|---|---|
1893–1894 | ||
1900 | ||
1907–1908 | ||
clang/test/SemaCXX/warn-unused-variables.cpp | ||
275–278 | I think the difference between Clang and GCC here is that GCC only diagnoses when this function is instantiated: https://godbolt.org/z/f6ddacT97 How do we behave when we instantiate it? Also, what happens with the test case as-written in the bug report: struct RAIIWrapper { RAIIWrapper(); ~RAIIWrapper(); }; void foo() { auto const guard = RAIIWrapper(); auto const& guard2 = RAIIWrapper(); auto && guard3 = RAIIWrapper(); } |
Comment Actions
Thanks, the additional test coverage makes it more clear that the changes are good. Please add a release note when landing though!