const auto & var = ObjectWithSideEffects();
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Sema/SemaDecl.cpp | ||
---|---|---|
1893–1894 | ||
1901 | ||
1908–1909 | ||
clang/test/SemaCXX/warn-unused-variables.cpp | ||
276–279 | 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!