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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
            Summary|[5/6/7/8 Regression]        |[6/7/8 Regression] Warning
                   |Warning about objects       |about objects through POD
                   |through POD mistakenly      |mistakenly claims the
                   |claims the object is a      |object is a pointer
                   |pointer                     |

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
With -Wconditionally-supported you'd get additional warning:
pr84076.C: In function ‘int main()’:
pr84076.C:7:27: warning: passing objects of non-trivially-copyable type
‘std::__cxx11::string’ {aka ‘class std::__cxx11::basic_string<char>’} through
‘...’ is conditionally supported [-Wconditionally-supported]
         printf("%s\n", str);
                           ^
The reason for the std::string * in diagnostics is that is how we actually
implement the ... passing of non-trivially-copyable objects, we pass them by
invisible reference as they are passed to named arguments, and the -Wformat
code can't find anymore whether the user actually passed the std::string object
or an address of it.

Reply via email to