You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Benjamin Bannier (JIRA)" <ji...@apache.org> on 2016/03/29 11:25:25 UTC
[jira] [Created] (MESOS-5059) Implement a clang-tidy check catching
uses of const ref to extend lifetimes
Benjamin Bannier created MESOS-5059:
---------------------------------------
Summary: Implement a clang-tidy check catching uses of const ref to extend lifetimes
Key: MESOS-5059
URL: https://issues.apache.org/jira/browse/MESOS-5059
Project: Mesos
Issue Type: Bug
Reporter: Benjamin Bannier
Mesos style discourages extending a value's lifetime with const references, e.g.,
{code}
const string& temporary = strings::join("/", "home", "user", ".bashrc");
{code}
We should add a clang-tidy check to catch such usage.
With good reason we do allow giving names to values with const references, e.g.,
{code}
struct S
{
string name_;
const int& name() const { return name_; }
};
void f(const S& s) {
const string& name = s.name();
}
{code}
This checker should not flag such usage, but it seems likely that it would identify incorrect getters which do actually return a value where instead returning a constant reference was needed.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)