Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-9742

Among overloaded functions, compiler chooses the wrong one

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: Medium Medium

      The attached file has two implementations of a function named foo. One is extern "C" and the other is generated from a template. The extern "C" foo should get chosen, but the template one does.

      % cl6x try1.cpp
      "try1.cpp", line 10: error: static assertion failed with "selected wrong overload"
                detected during instantiation of "T3 foo(T1, T2) [with T1=double, T2=double, T3=double]" at line 16
      1 error detected in the compilation of "try1.cpp".
      

      Remove the extern "C", then the correct function is chosen.

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: