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

            Bug ID: 90505
           Summary: gcc 9.1 rejects valid code
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: officesamurai at gmail dot com
  Target Milestone: ---

GCC 9.1 fails to compile the following code (previous versions compile it just
fine).

=== test.cpp ===
template <class T>
struct S
{
    template <class U, class V>
    static void foo(V)
    {
    }

    void bar()
    {
        foo<void>(1);
    }
};
===

=== Console ===
~/tmp$ g++-9.1.0 -c test.cpp
test.cpp: In member function ‘void S<T>::bar()’:
test.cpp:11:20: error: no matching function for call to ‘S<T>::foo<void>(int)’
   11 |         foo<void>(1);
      |                    ^
test.cpp:5:17: note: candidate: ‘template<class T> template<class U, class V>
static void S<T>::foo(V)’
    5 |     static void foo(V)
      |                 ^~~
test.cpp:5:17: note:   template argument deduction/substitution failed:
test.cpp:11:20: note:   mismatched types ‘V’ and ‘int’
   11 |         foo<void>(1);
      |       
===

=== Compiler version ===
~/tmp$ g++-9.1.0 -v
Using built-in specs.
COLLECT_GCC=g++-9.1.0
COLLECT_LTO_WRAPPER=/home/brd/soft/gcc-9.1.0/libexec/gcc/x86_64-pc-linux-gnu/9.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --prefix=/home/brd/soft/gcc-9.1.0
Thread model: posix
gcc version 9.1.0 (GCC) 
===

Reply via email to