IBM Support

PK94186: QUINTUS :226046


You can track all active APARs for this component.

APAR status

  • Closed as Permanent restriction.

Error description

  • Tied to PMR : 79214,999,724
    Description :
    Rhapsody generated code for friend functions that holds template
    parameters of type int gives the below compilation error
     Error C2668: 'connect' ambiguous call to overloaded function
    This case involves:
    ?  Template parameter in kind of 'int' (instead of the more
    ? friend to template function that one of its argument is a
    class .
    ? the class with the friend is also a template .
    Rhapsody generates:
    template ?int CL? friend void connect(ConnectablePort?CL??
    customer desired code :
    friend void connect??(ConnectablePort?CL?? dest);
    Workaround :
    use Friend property.
    Attachments :\\ilre-dc\TestCases\Rhapsody\
    PS: See Notes section for detailed information.

Local fix

  • Use 'Friend' property.

Problem summary

  • [APAR : PK94186]Code Generation with Friend functions :
    Error C2668: 'connect' ambiguous call to overloaded function

Problem conclusion

  • We found out the reasons for the compilation error. Here is
    the correct method to model such cases:
    First issue is that both, the class and the function have
    the same Template Parameter name "T", even there is no
    necessarily relation between the two.
    In such a case, adding of friend from the class to the
    function causes ambiguous between the T of the class and the
    T of the function, when using this T in the arguments.
    Giving different Template Parameter name solves this issue.
    See in the attached, I named the function template parameter
    "S" instead of "T".
    Second issue is the function arguments that their type is
    the template class with no specific instantiation. Generated
    code of this type is using the template parameter from the
    modeling of the class, and generate the type "A?T?". But
    this template parameter is not necessarily known in the used
    scope, which is out of the class.
    For example in our case, if the template parameter of the
    function named "S", you will get the prototype:
    template ?int S? void connect(const A?T?? argument_0, const
    A?T?? argument_1);
    T is not known here.
    Therefore, these arguments type should be modeled by
    declaration (on-the-fly) and not by using existing type.
    See in the attached, the arguments type is "const A?S??"
    Note that after these changes there is no need to have the
    function forward declaration before the class and I moved it
    to be after the class. (If you leave it before the class it
    will required forward declaration of the class before it and
    it does not RT and generated well at the moment). Also, I'm
    not sure if the user need the function to be in the same
    file with the class, or it is like that only for the
    synthetic sample. Starting from scratch (or removing of
    Source Artifacts) will generate the function to separate
    file, and it is also looks good and compiled well.
    The generated code of the attached model is compiled well in
    several compilers including VS 2008. But there is
    compilation error in VS 2005 which seems to us as defect of
    the compiler that fixed from 2005 to 2008. In order to work
    around this, they still need to use the "friend" property
    instead of the friend dependency. And give it the line that
    their compiler ask for.
    I gave this: template ?int S? friend int connect(const A?T??
    argument_0, const A?T?? argument_1);
    And it compiled well by VS 2005.
    Customer response:
    I tried out the suggested workaround and it worked for both
    other compilers, so thank you very much for your help.This
    looks like the path forward that we should follow during our

Temporary fix


APAR Information

  • APAR number


  • Reported component name


  • Reported component ID


  • Reported release


  • Status


  • PE




  • Special Attention


  • Submitted date


  • Closed date


  • Last modified date


  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

Applicable component levels

Document information

More support for: Rational Rhapsody

Software version: 7.5

Reference #: PK94186

Modified date: 10 June 2010