The following gives an error at line 20. However, if I change all
"doit1" to "doit". I will only get warnings. Is there any thing wrong
with gcc?
g++-3.3 -g -Wall -W -I/usr/local/include/clapack/ -c -o main.o main.cc
main.cc: In member function `void C::doit1(typename A<T>::iterator*)':
main.cc:20: error: parse error before `;' token
main.cc: In function `int main(int, char**)':
main.cc:25: warning: unused parameter `int argc'
main.cc:25: warning: unused parameter `char**argv'
make: *** [main.o] Error 1
/////////////////////
template <typename T>
class A {
public:
class iterator{
};
};
class B {
public:
template <typename T>
void doit(typename A<T>::iterator *it){
}
};
class C {
public:
template <typename T>
void doit1(typename A<T>::iterator *it){
B b;
b.doit<T>(it);//line 20
}
};
int main(int argc, char *argv[])
{
A<int>::iterator it1;
C c;
c.doit1<int>(&it1);
} 7 1246 Pe*******@gmail.com wrote: The following gives an error at line 20. However, if I change all "doit1" to "doit". I will only get warnings. Is there any thing wrong with gcc?
g++-3.3 -g -Wall -W -I/usr/local/include/clapack/ -c -o main.o main.cc main.cc: In member function `void C::doit1(typename A<T>::iterator*)': main.cc:20: error: parse error before `;' token main.cc: In function `int main(int, char**)': main.cc:25: warning: unused parameter `int argc' main.cc:25: warning: unused parameter `char**argv' make: *** [main.o] Error 1 /////////////////////
template <typename T> class A { public: class iterator{ }; };
class B { public: template <typename T> void doit(typename A<T>::iterator *it){ } };
class C { public: template <typename T> void doit1(typename A<T>::iterator *it){ B b; b.doit<T>(it);//line 20 } };
int main(int argc, char *argv[]) { A<int>::iterator it1; C c; c.doit1<int>(&it1); }
Comeau online seems to like it. Cross posting to gnu.g++.help Pe*******@gmail.com wrote: The following gives an error at line 20. However, if I change all "doit1" to "doit". I will only get warnings. Is there any thing wrong with gcc?
I see neither errors nor warning with gcc 3.4.2.
Ian
<Pe*******@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com... The following gives an error at line 20. However, if I change all "doit1" to "doit". I will only get warnings. Is there any thing wrong with gcc?
g++-3.3 -g -Wall -W -I/usr/local/include/clapack/ -c -o main.o main.cc main.cc: In member function `void C::doit1(typename A<T>::iterator*)': main.cc:20: error: parse error before `;' token
..... class B { public: template <typename T> void doit(typename A<T>::iterator *it){ } };
class C { public: template <typename T> void doit1(typename A<T>::iterator *it){ B b; b.doit<T>(it);//line 20
try with
b.template doit<T>(it);
Perhaps gcc 3.3 can't figure out that doit is template function,
but 3.4.2 compiles ok.
} };
Greetings, Bane.
red floyd <no*****@here.dude> writes: Pe*******@gmail.com wrote: The following gives an error at line 20. However, if I change all "doit1" to "doit". I will only get warnings. Is there any thing wrong with gcc? g++-3.3 -g -Wall -W -I/usr/local/include/clapack/ -c -o main.o
Comeau online seems to like it. Cross posting to gnu.g++.help
g++ 3.4.0, 3.4.3 and 4.0.0 also accept this.
Looks like a bug that has been fixed.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Branimir Maksimovic wrote: <Pe*******@gmail.com> wrote in message news:11**********************@g47g2000cwa.googlegr oups.com... The following gives an error at line 20. However, if I change all "doit1" to "doit". I will only get warnings. Is there any thing wrong with gcc?
g++-3.3 -g -Wall -W -I/usr/local/include/clapack/ -c -o main.o main.cc main.cc: In member function `void C::doit1(typename A<T>::iterator*)': main.cc:20: error: parse error before `;' token .... class B { public: template <typename T> void doit(typename A<T>::iterator *it){ } };
class C { public: template <typename T> void doit1(typename A<T>::iterator *it){ B b; b.doit<T>(it);//line 20
try with b.template doit<T>(it); Perhaps gcc 3.3 can't figure out that doit is template function, but 3.4.2 compiles ok.
} };
Greetings, Bane.
It is as you pointed out.
Is this form of envoking template member function "b.template
doit<T>(it);" in the C++ Standard?
Is it actually a bug of gcc 3.3?
In article <11**********************@g49g2000cwa.googlegroups .com>, Pe*******@gmail.com <Pe*******@gmail.com> wrote: Is this form of envoking template member function "b.template doit<T>(it);" in the C++ Standard?
Is it actually a bug of gcc 3.3?
Yes, for a round about mild discussion including this, see http://www.comeaucomputing.com/techt...lates/#esprobs
--
Greg Comeau / Celebrating 20 years of Comeauity!
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
<Pe*******@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com... Branimir Maksimovic wrote: <Pe*******@gmail.com> wrote in message news:11**********************@g47g2000cwa.googlegr oups.com... > The following gives an error at line 20. However, if I change all > "doit1" to "doit". I will only get warnings. Is there any thing wrong > with gcc? > > g++-3.3 -g -Wall -W -I/usr/local/include/clapack/ -c -o main.o main.cc > main.cc: In member function `void C::doit1(typename A<T>::iterator*)': > main.cc:20: error: parse error before `;' token .... > class B { > public: > template <typename T> > void doit(typename A<T>::iterator *it){ > } > }; > > class C { > public: > template <typename T> > void doit1(typename A<T>::iterator *it){ > B b; > b.doit<T>(it);//line 20
try with b.template doit<T>(it); Perhaps gcc 3.3 can't figure out that doit is template function, but 3.4.2 compiles ok.
> } > }; >
Greetings, Bane.
It is as you pointed out.
Is this form of envoking template member function "b.template doit<T>(it);" in the C++ Standard?
It is described in 5.2 postfix expressions.
Is it actually a bug of gcc 3.3?
Standard says this is optional, not mandatory, so it could be bug, but I'm
not really
sure.
Greetings, Bane. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Zhang Weiwu |
last post by:
Hello. I have a question that spining around my head for a long time. I
prefer to make this kind of if statement:
if (!$GLOBALS) Header(
'Location: '.$GLOBALS->
link('/',...
|
by: Jocab |
last post by:
Just had a look at the Wired.com site and it seems it's completely in
XHTML and CSS. I don't understand this snippet of code on their
homepage, though:
<link rel="stylesheet" type="text/css"...
|
by: HTML-JSClub |
last post by:
Just asking for opinions on whether I should subscribe to Wired (and
why). Thanks
|
by: Brian |
last post by:
Some small things about ico make me very confused.
I want give my winform app a new icon. I designed it but visual studio
insisted to use the default one. Isn't the icon's format 32 x 32?
...
|
by: tshad |
last post by:
Can you do a search for more that one string in another string?
Something like:
someString.IndexOf("something1","something2","something3",0)
or would you have to do something like:
if...
|
by: Anders Borum |
last post by:
Hello!
I've come across a strange behaviour in ASP.NET.
If you're examining the property "HttpContext.Current.Session.IsNewSession"
in a Page/UserControl, it always yields true, unless the...
|
by: zl2k |
last post by:
hi, all
I got a wired bug when using gcc -O2. In short, I have something like
int a, b;
....
assert(a < b); //line 1
cout<<a<<" "<<b<<endl; //line 2
assert(a < b); //line 3
The program...
|
by: dmcglynn |
last post by:
Hello all..
I have a strange issue. I am trying to do an opendir via a UNC path,
from my windows server to another windows machine.
As long as my remote machine is on a physically wired...
|
by: Ajm113 |
last post by:
Ok, first off I like to say hi and I am a developer of the Doom3 Scripter project and I wanted to go with C# and Visual Studios for the 2.0 area and I needed some help with both of those things.
...
|
by: Terry Reedy |
last post by:
from Wired magazine, April 2008 (arrived today), p.44:
Expired: ASP.NET; Tired: PHP; Wired: Django
Congrats to the Django crew.
http://www.djangoproject.com/
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |