public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58898] New: Adding default template argument causes to class template compile error
@ 2013-10-28 1:03 evgeny.panasyuk at gmail dot com
2014-07-07 14:11 ` [Bug c++/58898] Adding default template argument to class template with "most vexing parse" causes " paolo.carlini at oracle dot com
2014-07-07 14:18 ` paolo.carlini at oracle dot com
0 siblings, 2 replies; 3+ messages in thread
From: evgeny.panasyuk at gmail dot com @ 2013-10-28 1:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58898
Bug ID: 58898
Summary: Adding default template argument causes to class
template compile error
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: evgeny.panasyuk at gmail dot com
Following code fails to compile on GCC 4.8.1, but compiles OK and Clang 3.4 and
MSVC2010.
Live demo: http://coliru.stacked-crooked.com/a/5fa616a7f18e2485
/***************************/
template <typename = int>
struct Foo
{
Foo()
{
int t(int()); // Error
}
};
int main()
{
int t(int()); // OK
Foo<> a; // Error
}
/***************************/
main.cpp: In constructor 'Foo< <template-parameter-1-1> >::Foo()':
main.cpp:6:20: error: default argument for template parameter for class
enclosing 'int t(int (*)())'
int t(int()); // Error
^
main.cpp: In function 'int main()':
main.cpp:13:9: error: wrong number of template arguments (0, should be 1)
Foo<> a; // Error
^
main.cpp:2:8: error: provided for 'template<class> struct Foo'
struct Foo
^
main.cpp:13:12: error: invalid type in declaration before ';' token
Foo<> a; // Error
^
/***************************/
But following code compiles OK.
Live demo: http://coliru.stacked-crooked.com/a/3e6c7f85f2ee5615
template <typename>
struct Foo
{
Foo()
{
int t(int()); // OK
}
};
int main()
{
int t(int()); // OK
Foo<int> a; // OK
}
/***************************/
Original case was in StackOverflow Question:
http://stackoverflow.com/questions/19625314/inheriting-from-a-class-template-with-a-default-argument/19625343#19625343
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/58898] Adding default template argument to class template with "most vexing parse" causes compile error
2013-10-28 1:03 [Bug c++/58898] New: Adding default template argument causes to class template compile error evgeny.panasyuk at gmail dot com
@ 2014-07-07 14:11 ` paolo.carlini at oracle dot com
2014-07-07 14:18 ` paolo.carlini at oracle dot com
1 sibling, 0 replies; 3+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-07-07 14:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58898
--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
This is already fixed mainline and 4.9.1. I'm adding the testcase and closing
the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/58898] Adding default template argument to class template with "most vexing parse" causes compile error
2013-10-28 1:03 [Bug c++/58898] New: Adding default template argument causes to class template compile error evgeny.panasyuk at gmail dot com
2014-07-07 14:11 ` [Bug c++/58898] Adding default template argument to class template with "most vexing parse" causes " paolo.carlini at oracle dot com
@ 2014-07-07 14:18 ` paolo.carlini at oracle dot com
1 sibling, 0 replies; 3+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-07-07 14:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58898
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |4.9.1
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-07 14:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-28 1:03 [Bug c++/58898] New: Adding default template argument causes to class template compile error evgeny.panasyuk at gmail dot com
2014-07-07 14:11 ` [Bug c++/58898] Adding default template argument to class template with "most vexing parse" causes " paolo.carlini at oracle dot com
2014-07-07 14:18 ` paolo.carlini at oracle dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).