[Bug c++/79508] [6/7 Regression] Parse error in template argument list using nested template arguments
trufanovan at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Feb 14 18:39:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79508
--- Comment #3 from Alexander Trufanov <trufanovan at gmail dot com> ---
>When looking for a template after . or ->, only consider class templates.
Looks like it means the problem at least can be workarounded by wrapping
function into a class. The code:
>code
class C
{
public:
template< class T> void set_default() { }
};
template <class T> class random_positive_wrapper
{
void random_positive() { }
};
template<class T> void initialize(T& x)
{
x.template set_default<random_positive_wrapper<T> >();
}
int main ()
{
C x;
initialize<C>(x);
}
>code end
works:
truf@truf-laptop:~$ /usr/bin/g++ -Wall -Wextra -c t.cpp -o t.o
truf@truf-laptop:~$ /usr/bin/g++-4.6 -Wall -Wextra -c t.cpp -o t.o
truf@truf-laptop:~$ /usr/bin/g++-4.8 -Wall -Wextra -c t.cpp -o t.o
truf@truf-laptop:~$ /usr/bin/g++-4.9 -Wall -Wextra -c t.cpp -o t.o
truf@truf-laptop:~$ /usr/bin/clang++-3.6 -Wall -Wextra -c t.cpp -o t.o
truf@truf-laptop:~$ /usr/bin/clang++-3.8 -Wall -Wextra -c t.cpp -o t.o
truf@truf-laptop:~$ /usr/bin/g++-6 -Wall -Wextra -c t.cpp -o t.o
truf@truf-laptop:~$
More information about the Gcc-bugs
mailing list