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:~$

Reply via email to