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.

Reply via email to