ac-archive-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_CXX_TEMPLATE_KEYWORD_QUALIFIER VS. GCC 3.4


From: Bernardo Innocenti
Subject: Re: AC_CXX_TEMPLATE_KEYWORD_QUALIFIER VS. GCC 3.4
Date: Wed, 04 Feb 2004 21:41:48 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040115

MAISONOBE Luc wrote:
Bernardo Innocenti wrote:

the AC_CXX_TEMPLATE_KEYWORD_QUALIFIER test fails
with GCC 3.4.  I believe it's a bug in the test,
but I don't have access to the C++ standard to
verify.

[...]

I only have the 2 December 1996 draft handy yet, I am not sure the standard says the same. Here is an extract of the relevant paragraph. Could you check if it does work with gcc 3.4 ?

No, it doesn't.  I've now found the official version of the standard
and it seems there were some interesting changes:

When the name of a member template specialization appears after . or -> in a postfix-expression, or after :: in a qualified-id that explicitely depends on a template-argument (14.6.2), the member template name must be prefixed by the keyword template. Otherwise the name is assumed to name a non-template. [Example:

     class X {
     public:
             template<size_t> X* allox();
     };
     void f(X* p)
     {
             X* p1 = p->alloc<200>();
                     // ill-formed: < means less than

             X* p2 = p->template allox<200>();
                     // fine: < starts explicit qualification
     }
--end example]

From 14.2/4:

---cut---
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. [Example:
class X {
public:
       template<size_t> X* alloc();
       template<size_t> static X* adjust();
};
template<class T> void f(T* p)
{
       T* p1 = p->alloc<200>();
               // ill-formed: < means less than
       T* p2 = p->template alloc<200>();
               // OK: < starts template argument list
       T::adjust<100>();
               // ill-formed: < means less than
       T::template adjust<100>();
               // OK: < starts explicit qualification
}
--end example]

---cut---

So it seems GCC 3.4 is right and the test should be updated.

Shall I submit a patch?

--
 // Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/  http://www.develer.com/






reply via email to

[Prev in Thread] Current Thread [Next in Thread]