Bug 40336

Summary: Language linkage should be part of the function type
Product: gcc Reporter: Johannes Schaub <schaub.johannes>
Component: c++Assignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: amylaar, andrew.stubbs, bangerth, bkoz, christian.bruel, fang, gcc-bugs, hhinnant, jwakely.gcc, marc.glisse, nathan, pinskia, schaub.johannes, s__nakayama
Priority: P3    
Version: 4.4.0   
Target Milestone: ---   
Host: i686-pc-linux-gnu Target: i686-pc-linux-gnu
Build: Known to work:
Known to fail: Last reconfirmed:

Description Johannes Schaub 2009-06-04 14:15:19 UTC
Hello all, i discovered that the following code doesn't compile, why i expected that it compiles fine

template<typename, typename> struct F { typedef int type; };
template<typename A> struct F<A, A> { };

typedef void(*fp0)();
extern "C" typedef void (*fp1)();

int main() { F<fp0, fp1>::type i; }

// diagnostic:
main.cpp: In function 'int main()':
main.cpp:7: error: 'type' is not a member of 'F<void (*)(), void (*)()>'
main.cpp:7: error: expected ';' before 'i'

The problem seems to be that it thinks the function pointer types are the same - but C++ is very clear on that they are different types.
Comment 1 Andrew Pinski 2009-06-04 14:36:33 UTC

*** This bug has been marked as a duplicate of 2316 ***