Topic: namespace: 'using' not allowed for templates? or compiler error?
Author: roland.schwarz@chello.at ("Roland")
Date: Mon, 17 Mar 2003 21:31:13 +0000 (UTC) Raw View
Hi,
I found some strange behaviour, which I do not know wheter this is intended
behaviour or a compiler bug.
====================================
namespace n1 {
template<class O>
struct to1 {
};
struct o2 {
};
};
namespace n2 {
using n1::to1;
using n1::o2;
struct o3 {
};
};
int main(int argc, char* argv[])
{
n1::to1<double> ato1;
n1::o2 ao2;
// the following line does not compile
n2::to1<double> bto1; // syntax error : missing ';' before '<'
n2::o2 bo2;
n2::o3 bo3;
return 0;
}
====================================
I am using VC6 so I wouldn't be too much surprised if it is the compilers
fault.
Does anyone know?
Thank you,
Roland
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: dan.r.mcleran@seagate.com (Dan McLeran)
Date: Tue, 18 Mar 2003 17:42:30 +0000 (UTC) Raw View
===================================== MODERATOR'S COMMENT:
Please don't overquote.
===================================== END OF MODERATOR'S COMMENT
roland.schwarz@chello.at ("Roland") wrote in message news:<xeXca.257079$AV5.3006085@news.chello.at>...
> Hi,
>
> I found some strange behaviour, which I do not know wheter this is intended
> behaviour or a compiler bug.
>
> ====================================
> namespace n1 {
> template<class O>
> struct to1 {
> };
> struct o2 {
> };
> };
>
> namespace n2 {
> using n1::to1;
> using n1::o2;
> struct o3 {
> };
> };
>
> int main(int argc, char* argv[])
> {
> n1::to1<double> ato1;
> n1::o2 ao2;
>
> // the following line does not compile
> n2::to1<double> bto1; // syntax error : missing ';' before '<'
>
> n2::o2 bo2;
> n2::o3 bo3;
>
> return 0;
> }
>
> ====================================
>
> I am using VC6 so I wouldn't be too much surprised if it is the compilers
> fault.
> Does anyone know?
>
> Thank you,
> Roland
>
>
> ---
> [ comp.std.c++ is moderated. To submit articles, try just posting with ]
> [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
> [ --- Please see the FAQ before posting. --- ]
> [ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
gcc 3.2 compiles this with no errors
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]