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

            Bug ID: 81587
           Summary: GCC doesn't warn about calling functions that don't
                    exist
           Product: gcc
           Version: 5.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jg at jguk dot org
  Target Milestone: ---

The following seems strange, I don't see any warnings.

I had expected:

main.cpp: In function ‘int main()’:
main.cpp:7:22: error: ‘random_name’ was not declared in this scope
    float random_name(double haystack, double needle);                      
              ^
main.cpp:8:22: error: ‘missingf’ was not declared in this scope
     void* missingf(float test);
                      ^


I'm surprised that I don't need to actually have a return variable, or even
pass a parameter. It's the same compiled wtih G++ or GCC.

//g++ -O2 -Wall -Wextra -Wpedantic -o main main.cpp

#include <stdio.h>

int main (void)
{
    float random_name(double haystack, double needle);
    void* missingf(float test);

    printf("hello\n");

    return 0;
}

Reply via email to