public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/36353] New: Unclear error message in unused template
@ 2008-05-28 7:57 wim dot yedema at gmail dot com
2008-05-28 8:00 ` [Bug c++/36353] missing typename for unused template error message is unclear pinskia at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: wim dot yedema at gmail dot com @ 2008-05-28 7:57 UTC (permalink / raw)
To: gcc-bugs
I get these error messages:
aap.cc: In member function 'void Bar<T>::function(T)':
aap.cc:16: error: expected `;' before 'it'
aap.cc:18: error: 'it' was not declared in this scope
When I compile this code:
#include <iostream>
#include <list>
template<typename T>
class Foo {
public:
void function(T arg) { std::cout << arg; }
};
template<typename T>
class Bar {
std::list<Foo<T> *> foo_list;
public:
void function(T arg)
{
std::list<Foo<T> *>::iterator it;
for (it = foo_list.begin(); it!=foo_list.end(); it++) {
Foo<T> *el = (*it);
el->function (arg);
}
}
};
int
main(void)
{
#if 0
// Enabling this gives a better error message
Bar<int> bar;
bar.function(1);
#endif
return 1;
}
When you enabled the #ifdeffed out code you will get these much clearer error
messages too:
aap.cc: In member function 'void Bar<T>::function(T) [with T = int]':
aap.cc:31: instantiated from here
aap.cc:16: error: dependent-name 'std::list<Foo<T>*,std::allocator<Foo<T>*>
>::iterator' is parsed as a non-type, but instantiation yields a type
aap.cc:16: note: say 'typename std::list<Foo<T>*,std::allocator<Foo<T>*>
>::iterator' if a type is meant
verbose output:
trunk (--) ~/src/q/ g++ -v -save-temps aap.cc
Reading specs from
/sysmnt/cadappl_linuxi386_nsvr1/gcc/4.2.2.1/bin/../lib/gcc/i686-pc-linux-gnu/4.2.2/specs
Target: i686-pc-linux-gnu
Configured with: /home/gcc/gcc/gcc-4.2.2.1/gcc-4.2.2.1/configure
--prefix=/cadappl/gcc/4.2.2.1 --with-as=/cadappl/gcc/4.2.2.1/bin/as
--with-ld=/cadappl/gcc/4.2.2.1/bin/ld --enable-__cxa_atexit
--enable-threads=posix --with-march=i686 --with-tune=pentium4
--enable-languages=c,c++,fortran --with-gmp=/cadappl/gcc/4.2.2.1
--with-mpfr=/cadappl/gcc/4.2.2.1
Thread model: posix
gcc version 4.2.2
/sysmnt/cadappl_linuxi386_nsvr1/gcc/4.2.2.1/bin/../libexec/gcc/i686-pc-linux-gnu/4.2.2/cc1plus
-E -quiet -v -iprefix
/sysmnt/cadappl_linuxi386_nsvr1/gcc/4.2.2.1/bin/../lib/gcc/i686-pc-linux-gnu/4.2.2/
-D_GNU_SOURCE aap.cc -mtune=pentium4 -fpch-preprocess -o aap.ii
ignoring nonexistent directory
"/sysmnt/cadappl_linuxi386_nsvr1/gcc/4.2.2.1/bin/../lib/gcc/i686-pc-linux-gnu/4.2.2/../../../../i686-pc-linux-gnu/include"
ignoring duplicate directory
"/cadappl/gcc/4.2.2.1/lib/gcc/i686-pc-linux-gnu/4.2.2/../../../../include/c++/4.2.2"
ignoring duplicate directory
"/cadappl/gcc/4.2.2.1/lib/gcc/i686-pc-linux-gnu/4.2.2/../../../../include/c++/4.2.2/i686-pc-linux-gnu"
ignoring duplicate directory
"/cadappl/gcc/4.2.2.1/lib/gcc/i686-pc-linux-gnu/4.2.2/../../../../include/c++/4.2.2/backward"
ignoring duplicate directory
"/cadappl/gcc/4.2.2.1/lib/gcc/i686-pc-linux-gnu/4.2.2/include"
ignoring nonexistent directory
"/cadappl/gcc/4.2.2.1/lib/gcc/i686-pc-linux-gnu/4.2.2/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/sysmnt/cadappl_linuxi386_nsvr1/gcc/4.2.2.1/bin/../lib/gcc/i686-pc-linux-gnu/4.2.2/../../../../include/c++/4.2.2
/sysmnt/cadappl_linuxi386_nsvr1/gcc/4.2.2.1/bin/../lib/gcc/i686-pc-linux-gnu/4.2.2/../../../../include/c++/4.2.2/i686-pc-linux-gnu
/sysmnt/cadappl_linuxi386_nsvr1/gcc/4.2.2.1/bin/../lib/gcc/i686-pc-linux-gnu/4.2.2/../../../../include/c++/4.2.2/backward
/sysmnt/cadappl_linuxi386_nsvr1/gcc/4.2.2.1/bin/../lib/gcc/i686-pc-linux-gnu/4.2.2/include
/usr/local/include
/cadappl/gcc/4.2.2.1/include
/usr/include
End of search list.
/sysmnt/cadappl_linuxi386_nsvr1/gcc/4.2.2.1/bin/../libexec/gcc/i686-pc-linux-gnu/4.2.2/cc1plus
-fpreprocessed aap.ii -quiet -dumpbase aap.cc -mtune=pentium4 -auxbase aap
-version -o aap.s
GNU C++ version 4.2.2 (i686-pc-linux-gnu)
compiled by GNU C version 4.2.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 473b7610f3bef24f1da62f9e674d528f
aap.cc: In member function 'void Bar<T>::function(T)':
aap.cc:16: error: expected `;' before 'it'
aap.cc:18: error: 'it' was not declared in this scope
--
Summary: Unclear error message in unused template
Product: gcc
Version: 4.2.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: wim dot yedema at gmail dot com
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36353
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/36353] missing typename for unused template error message is unclear
2008-05-28 7:57 [Bug c++/36353] New: Unclear error message in unused template wim dot yedema at gmail dot com
@ 2008-05-28 8:00 ` pinskia at gcc dot gnu dot org
2008-05-28 8:01 ` wim dot yedema at gmail dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-05-28 8:00 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Keywords| |diagnostic
Summary|Unclear error message in |missing typename for unused
|unused template |template error message is
| |unclear
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36353
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/36353] missing typename for unused template error message is unclear
2008-05-28 7:57 [Bug c++/36353] New: Unclear error message in unused template wim dot yedema at gmail dot com
2008-05-28 8:00 ` [Bug c++/36353] missing typename for unused template error message is unclear pinskia at gcc dot gnu dot org
@ 2008-05-28 8:01 ` wim dot yedema at gmail dot com
2008-05-28 8:01 ` pinskia at gcc dot gnu dot org
2008-05-28 8:02 ` wim dot yedema at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: wim dot yedema at gmail dot com @ 2008-05-28 8:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from wim dot yedema at gmail dot com 2008-05-28 08:00 -------
Created an attachment (id=15689)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15689&action=view)
preprocessed case
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36353
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/36353] missing typename for unused template error message is unclear
2008-05-28 7:57 [Bug c++/36353] New: Unclear error message in unused template wim dot yedema at gmail dot com
2008-05-28 8:00 ` [Bug c++/36353] missing typename for unused template error message is unclear pinskia at gcc dot gnu dot org
2008-05-28 8:01 ` wim dot yedema at gmail dot com
@ 2008-05-28 8:01 ` pinskia at gcc dot gnu dot org
2008-05-28 8:02 ` wim dot yedema at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-05-28 8:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2008-05-28 08:00 -------
*** This bug has been marked as a duplicate of 15946 ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36353
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/36353] missing typename for unused template error message is unclear
2008-05-28 7:57 [Bug c++/36353] New: Unclear error message in unused template wim dot yedema at gmail dot com
` (2 preceding siblings ...)
2008-05-28 8:01 ` pinskia at gcc dot gnu dot org
@ 2008-05-28 8:02 ` wim dot yedema at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: wim dot yedema at gmail dot com @ 2008-05-28 8:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from wim dot yedema at gmail dot com 2008-05-28 08:01 -------
Created an attachment (id=15690)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15690&action=view)
test case
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36353
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-05-28 8:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-28 7:57 [Bug c++/36353] New: Unclear error message in unused template wim dot yedema at gmail dot com
2008-05-28 8:00 ` [Bug c++/36353] missing typename for unused template error message is unclear pinskia at gcc dot gnu dot org
2008-05-28 8:01 ` wim dot yedema at gmail dot com
2008-05-28 8:01 ` pinskia at gcc dot gnu dot org
2008-05-28 8:02 ` wim dot yedema at gmail 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).