This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/80771] GCC ignores default template argument declaration in the template definition


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|wrong-code                  |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-05-16
     Ever confirmed|0                           |1

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
template<int> struct enable_if { using type = void; };

struct Foo { };

// This is a template function declaration, where second template argument
declared without a default
template <typename T, typename>
void foo(const Foo &, T);

// This is a template function definition; second template argument now has a
default declared
template <typename T, typename = typename enable_if<1>::type>
void foo(const Foo &, T)
{
}

int main()
{
    foo(Foo{}, 1);
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]