The attached testcase, extracted from the AC_CXX_TEMPLATE_KEYWORD_QUALIFIER macro, produces the following error with 3.4 and tree-ssa: foo.cc: In function `int main()': foo.cc:9: error: `template' (as a disambiguator) is only allowed within templates Used to work fine back in 3.3.2. According to the standard (14.2/4): When the name of a member template specialization appears after . or -> in a postfix-expression, or after nested-name-specifier in a qualified-id, and the postfix-expression or qualified-id explicitly depends on a template-parameter (14.6.2), the member template name must be prefixed by the keyword template. Otherwise the name is assumed to name a non-template.
I think the part that really applies here is "and the postfix-expression or qualified-id explicitly depends on a template-parameter (14.6.2)" part so this bug is invalid. The other part that applies is in the note of 14.2/5: "Note: the keyword template may not be applied to non-template members of class templates. ". Unless you can prove otherwise with a source showing what the problem is, I am closing this bug as invalid.
There has been a clarification in one DR that "template" is only required if the part BEFORE the dot or :: is actually dependent on a template parameter. This was missing from the standard. That being said, show us some code and we can check your claim. W.
Sorry, I thought I had aborted this bug filing, but eventually Mozilla submitted the form when I opened another URL in the same window ;-) The problem has been cleared with the ac-archive people and I'm going to submit an updated configure test. This was the failing testcase from ac_cxx_template_keyword_qualifier.m4: class A { public: A() {}; template<class T> static T convert() { return T(); } }; int main () { double z = A::template convert<double>(); return 0; } And this is what the updated configure test should look like: class X { public: template<int> void member() { } template<int> static void static_member() { } }; template<class T> void f(T* p) { p->template member<200>(); // OK: < starts template argument list T::template static_member<100>(); // OK: < starts explicit qualification } int main() { X x; f(&x); return 0; }
This was exactly the case I was talking about. In your first example, A is not template dependent, so A::convert<double> shouldn't have the "template" in the middle. W.
Subject: Re: template keyword used as a disambiguator not conforming to ISO C++ 98 "bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes: | This was exactly the case I was talking about. In your first example, | A is not template dependent, so A::convert<double> shouldn't have | the "template" in the middle. More precisely, the informaous "::template" is not allowed outside of a template code. However, it is allowed in a template even if the name preceding it is not dependent. -- Gaby
> More precisely, the informaous "::template" is not allowed outside of > a template code. However, it is allowed in a template even if the > name preceding it is not dependent. ... which, by the way, is exactly what our diagnostic says: foo.cc:9: error: `template' (as a disambiguator) is only allowed within templates
Subject: Re: template keyword used as a disambiguator not conforming to ISO C++ 98 "giovannibajo at libero dot it" <gcc-bugzilla@gcc.gnu.org> writes: | > More precisely, the informaous "::template" is not allowed outside of | > a template code. However, it is allowed in a template even if the | > name preceding it is not dependent. | | ... which, by the way, is exactly what our diagnostic says: | | foo.cc:9: error: `template' (as a disambiguator) is only allowed within | templates I was adding a precision to the message I was replying to which were implying that the name before "::template" ought to be dependent. -- Gaby
Reopening ...
... to close as invalid.