public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/35008] New: Bug in processing nested typedef in nested template class in method definition @ 2008-01-29 4:13 wirawan0 at gmail dot com 2008-01-29 13:34 ` [Bug c++/35008] " rguenth at gcc dot gnu dot org ` (6 more replies) 0 siblings, 7 replies; 8+ messages in thread From: wirawan0 at gmail dot com @ 2008-01-29 4:13 UTC (permalink / raw) To: gcc-bugs [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 2393 bytes --] The following testcase fails to compile: template <typename data1> struct outer1 { typedef int my_value_type; // define a nested datatype template <typename servert> struct inner1 { typedef outer1<data1> myboss; // borrow the boss's datatype << -- don't reduce or change this one: typedef typename myboss::my_value_type my_value_type; my_value_type return_x(); }; }; // g++ 4 choked on this one: template <typename data1> template <typename servert> typename outer1<data1>::template inner1<servert>::my_value_type outer1<data1>::inner1<servert>::return_x() { return 4; } void testme() { outer1<float>::inner1<int> Inner1; int rslt = Inner1.return_x(); // to instantiate and cause error } It is basically like this: * outer1 class template has a nested datatype called "my_value_type" * inner1 borrows the "my_value_type" from outer1 (its parent) Then when we want to instantiate return_x() above, g++ gives the following error: template-typename4.cpp:19: error: prototype for typename outer1<data1>::inner1<servert>::my_value_type outer1<data1>::inner1<servert>::return_x() does not match any in class outer1<data1>::inner1<servert> template-typename4.cpp:10: error: candidate is: typename outer1<data1>::my_value_type outer1<data1>::inner1<servert>::return_x() template-typename4.cpp:19: error: template definition of non-template typename outer1<data1>::inner1<servert>::my_value_type outer1<data1>::inner1<servert>::return_x() I can work around this by changing line 18 above: typename outer1<data1>::template inner1<servert>::my_value_type to typename outer1<data1>::my_value_type then it would compile. But I think this is a bug. It used to compile with g++ 3. Other compilers such as Intel C++ (version 9.1), PGI C++ 7 all accept this language construct. -- Summary: Bug in processing nested typedef in nested template class in method definition Product: gcc Version: 4.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wirawan0 at gmail dot com GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35008 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/35008] Bug in processing nested typedef in nested template class in method definition 2008-01-29 4:13 [Bug c++/35008] New: Bug in processing nested typedef in nested template class in method definition wirawan0 at gmail dot com @ 2008-01-29 13:34 ` rguenth at gcc dot gnu dot org 2008-01-29 15:17 ` wirawan0 at gmail dot com ` (5 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: rguenth at gcc dot gnu dot org @ 2008-01-29 13:34 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from rguenth at gcc dot gnu dot org 2008-01-29 13:06 ------- The first snippet works for me, the second says t.C:3: error: expected nested-name-specifier before 'outer1' t.C:3: error: too many template-parameter-lists t.C: In function 'void testme()': t.C:11: error: 'outer1' was not declared in this scope t.C:11: error: expected primary-expression before 'float' t.C:11: error: expected `;' before 'float' t.C:12: error: 'Inner1' was not declared in this scope so - what is the testcase that you are looking at? -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |WAITING http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35008 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/35008] Bug in processing nested typedef in nested template class in method definition 2008-01-29 4:13 [Bug c++/35008] New: Bug in processing nested typedef in nested template class in method definition wirawan0 at gmail dot com 2008-01-29 13:34 ` [Bug c++/35008] " rguenth at gcc dot gnu dot org @ 2008-01-29 15:17 ` wirawan0 at gmail dot com 2008-01-29 15:23 ` wirawan0 at gmail dot com ` (4 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: wirawan0 at gmail dot com @ 2008-01-29 15:17 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from wirawan0 at gmail dot com 2008-01-29 14:59 ------- The whole snippet must be included the (un)desirable error to show up. Let me give an attachment to make it clear. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35008 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/35008] Bug in processing nested typedef in nested template class in method definition 2008-01-29 4:13 [Bug c++/35008] New: Bug in processing nested typedef in nested template class in method definition wirawan0 at gmail dot com 2008-01-29 13:34 ` [Bug c++/35008] " rguenth at gcc dot gnu dot org 2008-01-29 15:17 ` wirawan0 at gmail dot com @ 2008-01-29 15:23 ` wirawan0 at gmail dot com 2008-01-29 15:35 ` rguenth at gcc dot gnu dot org ` (3 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: wirawan0 at gmail dot com @ 2008-01-29 15:23 UTC (permalink / raw) To: gcc-bugs ------- Comment #3 from wirawan0 at gmail dot com 2008-01-29 15:00 ------- Created an attachment (id=15047) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15047&action=view) Sample code to cause compilation error. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35008 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/35008] Bug in processing nested typedef in nested template class in method definition 2008-01-29 4:13 [Bug c++/35008] New: Bug in processing nested typedef in nested template class in method definition wirawan0 at gmail dot com ` (2 preceding siblings ...) 2008-01-29 15:23 ` wirawan0 at gmail dot com @ 2008-01-29 15:35 ` rguenth at gcc dot gnu dot org 2008-01-29 15:37 ` rguenth at gcc dot gnu dot org ` (2 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: rguenth at gcc dot gnu dot org @ 2008-01-29 15:35 UTC (permalink / raw) To: gcc-bugs ------- Comment #4 from rguenth at gcc dot gnu dot org 2008-01-29 15:25 ------- *** Bug 35016 has been marked as a duplicate of this bug. *** -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35008 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/35008] Bug in processing nested typedef in nested template class in method definition 2008-01-29 4:13 [Bug c++/35008] New: Bug in processing nested typedef in nested template class in method definition wirawan0 at gmail dot com ` (3 preceding siblings ...) 2008-01-29 15:35 ` rguenth at gcc dot gnu dot org @ 2008-01-29 15:37 ` rguenth at gcc dot gnu dot org 2008-12-29 14:35 ` [Bug c++/35008] [4.2 Regression] " pinskia at gcc dot gnu dot org 2009-03-31 15:05 ` jsm28 at gcc dot gnu dot org 6 siblings, 0 replies; 8+ messages in thread From: rguenth at gcc dot gnu dot org @ 2008-01-29 15:37 UTC (permalink / raw) To: gcc-bugs ------- Comment #5 from rguenth at gcc dot gnu dot org 2008-01-29 15:32 ------- I believe we have a dup for this somewhere. Broken on the 4.1 and 4.2 branch. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |NEW Ever Confirmed|0 |1 Keywords| |rejects-valid Known to fail| |4.1.2 Known to work| |4.1.1 4.3.0 Last reconfirmed|0000-00-00 00:00:00 |2008-01-29 15:32:29 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35008 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/35008] [4.2 Regression] Bug in processing nested typedef in nested template class in method definition 2008-01-29 4:13 [Bug c++/35008] New: Bug in processing nested typedef in nested template class in method definition wirawan0 at gmail dot com ` (4 preceding siblings ...) 2008-01-29 15:37 ` rguenth at gcc dot gnu dot org @ 2008-12-29 14:35 ` pinskia at gcc dot gnu dot org 2009-03-31 15:05 ` jsm28 at gcc dot gnu dot org 6 siblings, 0 replies; 8+ messages in thread From: pinskia at gcc dot gnu dot org @ 2008-12-29 14:35 UTC (permalink / raw) To: gcc-bugs -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Bug in processing nested |[4.2 Regression] Bug in |typedef in nested template |processing nested typedef in |class in method definition |nested template class in | |method definition Target Milestone|--- |4.2.5 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35008 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/35008] [4.2 Regression] Bug in processing nested typedef in nested template class in method definition 2008-01-29 4:13 [Bug c++/35008] New: Bug in processing nested typedef in nested template class in method definition wirawan0 at gmail dot com ` (5 preceding siblings ...) 2008-12-29 14:35 ` [Bug c++/35008] [4.2 Regression] " pinskia at gcc dot gnu dot org @ 2009-03-31 15:05 ` jsm28 at gcc dot gnu dot org 6 siblings, 0 replies; 8+ messages in thread From: jsm28 at gcc dot gnu dot org @ 2009-03-31 15:05 UTC (permalink / raw) To: gcc-bugs ------- Comment #6 from jsm28 at gcc dot gnu dot org 2009-03-31 15:04 ------- Closing 4.2 branch, fixed in 4.3. -- jsm28 at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Known to fail|4.1.2 |4.1.2 4.2.5 Resolution| |FIXED Target Milestone|4.2.5 |4.3.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35008 ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-03-31 15:05 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-01-29 4:13 [Bug c++/35008] New: Bug in processing nested typedef in nested template class in method definition wirawan0 at gmail dot com 2008-01-29 13:34 ` [Bug c++/35008] " rguenth at gcc dot gnu dot org 2008-01-29 15:17 ` wirawan0 at gmail dot com 2008-01-29 15:23 ` wirawan0 at gmail dot com 2008-01-29 15:35 ` rguenth at gcc dot gnu dot org 2008-01-29 15:37 ` rguenth at gcc dot gnu dot org 2008-12-29 14:35 ` [Bug c++/35008] [4.2 Regression] " pinskia at gcc dot gnu dot org 2009-03-31 15:05 ` jsm28 at gcc dot gnu dot 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).