Issue 148942
Summary [clang-tidy] modernize-return-braced-init-list and complex type casts
Labels clang-tidy
Assignees
Reporter EugeneZelenko
    I got `modernize-return-braced-init-list` warning for next code:

```
#include <boost/python/extract.hpp>
#include <boost/python/object.hpp>

std::string test(const boost::python::object& data_set, const char* attr)
{
    const boost::python::object attribute_object = data_set.attr(attr);
    if (attribute_object.is_none())
    {
        return {};
    }
    else
 {
        return boost::python::extract<std::string>(attribute_object);
 }
}
```

```
warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
      return boost::python::extract<std::string>(attribute_object);
```

I tried 19.1 and ~ month-old `main`. Boost version is 1.86. Sorry, was not able to reproduce in on GodBolt, because it's not obvious how to specify path to local Boost libraries.

I think will be good idea to have option to filter out such complex type casts in `modernize-return-braced-init-list`.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to