public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/60605] New: incorrect diagosis of default template argument for function declaration inside class template member function @ 2014-03-20 22:04 public at alisdairm dot net 2014-06-17 23:04 ` [Bug c++/60605] " jason at gcc dot gnu.org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: public at alisdairm dot net @ 2014-03-20 22:04 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60605 Bug ID: 60605 Summary: incorrect diagosis of default template argument for function declaration inside class template member function Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: public at alisdairm dot net This bug looks looks obscure, but breaks our 'static assert' facility for C++03 compilers (after applying a workaround for the gcc 4.8 unused typedef warning): template <typename T = int> struct Foo { void bar() { void bug(); } }; This should simply be declaring 'bug' as a function in the enclosing namespace, the default template parameter on the class template is irrelevant, 'bug' is neither a function template nor a member function of a class template. With g++ -std=c++03 I get: main.cpp: In member function 'void Foo<T>::bar()': main.cpp:4:18: error: default template arguments may not be used in function templates without -std=c++11 or -std=gnu++11 void bug(); ^ With g++ -std=c++11 I get: main.cpp: In member function 'void Foo<T>::bar()': main.cpp:4:18: error: default argument for template parameter for class enclosing 'void bug()' void bug(); ^ I am not sure what language rule the C++11 switch thinks it is diagnosing, this code is accepted by the Clang compiler which I used as a cross-check. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/60605] incorrect diagosis of default template argument for function declaration inside class template member function 2014-03-20 22:04 [Bug c++/60605] New: incorrect diagosis of default template argument for function declaration inside class template member function public at alisdairm dot net @ 2014-06-17 23:04 ` jason at gcc dot gnu.org 2014-06-17 23:09 ` jason at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: jason at gcc dot gnu.org @ 2014-06-17 23:04 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60605 --- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> --- Author: jason Date: Tue Jun 17 23:03:43 2014 New Revision: 211753 URL: https://gcc.gnu.org/viewcvs?rev=211753&root=gcc&view=rev Log: PR c++/60605 * pt.c (check_default_tmpl_args): Check DECL_LOCAL_FUNCTION_P. Added: branches/gcc-4_8-branch/gcc/testsuite/g++.dg/template/local-fn1.C Modified: branches/gcc-4_8-branch/gcc/cp/ChangeLog branches/gcc-4_8-branch/gcc/cp/pt.c ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/60605] incorrect diagosis of default template argument for function declaration inside class template member function 2014-03-20 22:04 [Bug c++/60605] New: incorrect diagosis of default template argument for function declaration inside class template member function public at alisdairm dot net 2014-06-17 23:04 ` [Bug c++/60605] " jason at gcc dot gnu.org @ 2014-06-17 23:09 ` jason at gcc dot gnu.org 2014-06-17 23:11 ` jason at gcc dot gnu.org 2014-06-17 23:11 ` jason at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: jason at gcc dot gnu.org @ 2014-06-17 23:09 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60605 --- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> --- Author: jason Date: Tue Jun 17 23:09:20 2014 New Revision: 211754 URL: https://gcc.gnu.org/viewcvs?rev=211754&root=gcc&view=rev Log: PR c++/60605 * pt.c (check_default_tmpl_args): Check DECL_LOCAL_FUNCTION_P. Added: trunk/gcc/testsuite/g++.dg/template/local-fn1.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/60605] incorrect diagosis of default template argument for function declaration inside class template member function 2014-03-20 22:04 [Bug c++/60605] New: incorrect diagosis of default template argument for function declaration inside class template member function public at alisdairm dot net 2014-06-17 23:04 ` [Bug c++/60605] " jason at gcc dot gnu.org 2014-06-17 23:09 ` jason at gcc dot gnu.org @ 2014-06-17 23:11 ` jason at gcc dot gnu.org 2014-06-17 23:11 ` jason at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: jason at gcc dot gnu.org @ 2014-06-17 23:11 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60605 --- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> --- Author: jason Date: Tue Jun 17 23:10:33 2014 New Revision: 211756 URL: https://gcc.gnu.org/viewcvs?rev=211756&root=gcc&view=rev Log: PR c++/60605 * pt.c (check_default_tmpl_args): Check DECL_LOCAL_FUNCTION_P. Added: branches/gcc-4_9-branch/gcc/testsuite/g++.dg/template/local-fn1.C Modified: branches/gcc-4_9-branch/gcc/cp/ChangeLog branches/gcc-4_9-branch/gcc/cp/pt.c ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/60605] incorrect diagosis of default template argument for function declaration inside class template member function 2014-03-20 22:04 [Bug c++/60605] New: incorrect diagosis of default template argument for function declaration inside class template member function public at alisdairm dot net ` (2 preceding siblings ...) 2014-06-17 23:11 ` jason at gcc dot gnu.org @ 2014-06-17 23:11 ` jason at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: jason at gcc dot gnu.org @ 2014-06-17 23:11 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60605 Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |jason at gcc dot gnu.org Resolution|--- |FIXED Target Milestone|--- |4.8.4 --- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> --- Fixed for 4.8.4/4.9.1/trunk ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-06-17 23:11 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-03-20 22:04 [Bug c++/60605] New: incorrect diagosis of default template argument for function declaration inside class template member function public at alisdairm dot net 2014-06-17 23:04 ` [Bug c++/60605] " jason at gcc dot gnu.org 2014-06-17 23:09 ` jason at gcc dot gnu.org 2014-06-17 23:11 ` jason at gcc dot gnu.org 2014-06-17 23:11 ` jason at gcc dot gnu.org
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).