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

            Bug ID: 70414
           Summary: Function declaration in other scope: type safety
                    violation
           Product: gcc
           Version: 4.8.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: [email protected]
  Target Milestone: ---

The following code compiles: 

-----------------------------------------
#include<iostream>

void t(){
    std::cout << "func t()" << std::endl;
}

int main(int argc, char **argv) {
    int t(); 
    std::cout << t() << std::endl;
}
-----------------------------------------

Output:
func t()\n6295712

This should not compile in my opinion because the two function declarations are
of different type.

I'm also referring to (I asked this question):
https://stackoverflow.com/questions/36224099/violation-of-type-safety-in-c-with-function-declaration-of-other-type

Reply via email to