Issue 96458
Summary -Wdangling false positive on string literal
Labels clang:frontend
Assignees
Reporter hokein
    Clang emits a warning on the following code:

```
void test() {
 const char* bad  = (char []){"abc"}; // bad: -Wdangling warning.
 const char* good = (const char*){"abc"}; // good, no warning.
}
```

According to the standard `Evaluating a string-literal results in a string literal object with static storage duration`, it is safe to have a pointer that points to the string literal.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to