mgehre / llvm-project

The home of the clang-based implementation of lifetime safety warnings.
39 stars 4 forks source link

Brace initialization does not trigger -Wdangling-gsl #95

Open mgehre opened 4 years ago

mgehre commented 4 years ago

In

#include <string_view>
#include <string>

std::string f();

// Type your code here, or load an example.
int square(int num) {
    std::string_view a(f());
    std::string_view b{f()};
    std::string_view c;
    c = f();
    return num * num;
}

only a is diagosed, even though b and c have the same issue. (see https://godbolt.org/z/dz67ZD)

fyi @Xazax-hun

Xazax-hun commented 4 years ago

Thanks! I will try to look into it and fix it upstream.