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

            Bug ID: 66266
           Summary: Abbreviated function template does not behave as
                    expected
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bruno.manga95 at gmail dot com
  Target Milestone: ---

Although abbreviated function templates are not part of ISO c++14 (but part of
the Concepts ts), the following code does not behave as its equivalent function
template (as described in n4377 section 8.3.5) and the assertion fails:

auto sum_auto(auto x, auto y)
{
    return x+y;
}

template <typename T, typename U>
auto sum_template(T x, U y)
{
    return x+y;
}

int main()
{
   //sum_auto returns 10 while sum_template returns 10.1
    assert(sum_auto(5, 5.1) == sum_template(5, 5.1)); 
}

Reply via email to