[Bug c++/91182] New: deprecated attribute string-literal

aaron.ballman+gcc at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Jul 16 14:40:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91182

            Bug ID: 91182
           Summary: deprecated attribute string-literal
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aaron.ballman+gcc at gmail dot com
  Target Milestone: ---

Using a wide string literal argument to the deprecated attribute has
unfortunate behavior when trying to print that argument as part of a
diagnostic. Consider:
```
[[deprecated(L"Test")]] void foo();

int main() {
  foo();
}
```
Produces this for output:

warning: 'void foo()' is deprecated: T [-Wdeprecated-declarations]

It seems that the diagnostic is treating the literal as always being a narrow
string literal. Similar bad behavior happens with u and U prefixes as well.


More information about the Gcc-bugs mailing list