This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/80771] GCC ignores default template argument declaration in the template definition
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 16 May 2017 15:17:17 +0000
- Subject: [Bug c++/80771] GCC ignores default template argument declaration in the template definition
- Auto-submitted: auto-generated
- References: <bug-80771-4@http.gcc.gnu.org/bugzilla/>
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);
}