Boost logo

Boost :

Subject: Re: [boost] nested function templates on GCC
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2012-09-30 14:52:19


On Sunday 30 September 2012 19:18:32 Adam Wulkiewicz wrote:
> Hi,
>
> Currently I'm working on a spatial index and was considering using
> methods templates until I've tested it on GCC. Consider the following
> simple example:
>
> template <typename T1, typename T2>
> struct boom {};
>
> struct aaa
> {
> template <typename T>
> void boom() {}
> };
>
> template <typename T>
> struct bbb
> {
> void test()
> {
> T t;
> t.template boom<int>(); // <- here GCC resolves struct boom
> }
> };

Assuming bbb<aaa>::test() is called, confirmed with GCC 4.7. Looks like a
compiler bug to me. The "t" expression is type dependent on the template
parameter (14.6.2.2), which makes the "boom" method call dependent as well.
Name lookup should be performed at the point of the template instantiation,
where aaa::boom should be found. This should probably be reported to the GCC
dev team.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk