[Bug c++/29038] New: missing diagnostic for initializer with non-matching language linkage

amylaar at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Sep 12 16:48:00 GMT 2006


The following testcase should elicit a diagnostic:

extern "C++" int f (int i);
extern "C"
{
  typedef int (*T) (int i);
}

T p = f;


The C++ standard section 7.5 clause 1 says that functions with different
language linkages are not the same type, and so one cannot be assigned to the
other, even if they appear to have the same signature. This problem also occurs
in the opposite sense to the example, i.e. with T having C++ linakage and f
having C linkage.

Regarding the initializer in question, 8.5 ; 14 case 6 says: ... standard
conversions (clause 4) will be used ... if the conversion cannot be done, the
initialization is ill-formed. Clause 4 does not list any conversion to change
the language linkage of a function or pointer to function type.


-- 
           Summary: missing diagnostic for initializer with non-matching
                    language linkage
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: amylaar at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29038



More information about the Gcc-bugs mailing list