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

            Bug ID: 79009
           Summary: Missing 'inconsistent deduction for ‘auto’' error when
                    having a dependent initializer and a nondependent one
                    in the same declaration
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
                CC: inadgob at yahoo dot com, jakub at gcc dot gnu.org,
                    jason at gcc dot gnu.org, lhyatt at gmail dot com,
                    marxin at gcc dot gnu.org, rs2740 at gmail dot com,
                    unassigned at gcc dot gnu.org, webrown.cpp at gmail dot com
        Depends on: 78693
  Target Milestone: ---

+++ This bug was initially created as a clone of Bug #78693 +++

The following testcase should be rejected during instantiation, because the
auto deduced type in the same simple declaration is deduced differently.
But we don't preserve the information what decls appeared together until
instantiation, so don't diagnose it right now.

template <class T>
void
foo (T t)
{
  auto i = t, j = 1;
}

template <class T>
void
bar (T t)
{
  auto i = 1, j = t, k = 2;
}

template <class T, class U>
void
foo (T t, U u)
{
  auto i = t, j = u;
}

void
foo ()
{
  foo (0L);
  bar (0L);
  foo (1, 2L);
}


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78693
[Bug 78693] [6 Regression] Bogus 'inconsistent deduction for ‘auto’' error when
having a dependent initializer and a nondependent one in the same declaration

Reply via email to