This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/82466] New: Missing warning for re-declaration of built-in function as variable


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

            Bug ID: 82466
           Summary: Missing warning for re-declaration of built-in
                    function as variable
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bernd.edlinger at hotmail dot de
  Target Milestone: ---

cat test.cc
int printf;
int
main()
{
  __builtin_printf("%f\n", 3.14);
}


gcc -Wall -Wextra test.cc
./a.out 
Segmentation fault (core dumped)

OTOH:

gcc -x c test.cc
test.cc:1:5: warning: built-in function 'printf' declared as non-function
 int printf;
     ^~~~~~


So C++ should print a warning like C.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]