Skip to content

No -Wdangling-gsl warning if a gsl-pointer object is construct from a gsl-owner object in a container. #100384

@hokein

Description

@hokein

See the example below:

#include <vector>
#include <string>
#include <string_view>
using namespace std;

void test() {
  const std::string& a = std::vector<std::string>({""}).at(0); // good: give a warning
  string_view b = std::string(); // good: gives a warning
  string_view c = std::vector<std::string>({""}).at(0); // bad: no diagnostic emitted.
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions