This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/9634: [3.4 regression] Problems with templates (SFINAE)


http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9634

Yes, this is DR224
(http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_defects.html#224), which is
in WP status (so the resolution will be adopted in the next version of the
standard). Basically, this PR can be sumed up in the following code:

--------------------------------------
template <typename T>
struct A
{
    typedef int Bar;

    template <typename>
    struct N {};

    typedef Bar          type1;
    typedef A::Bar       type2;
    typedef A<T>::Bar    type3;

    typedef N<int>       type4;
    typedef A::N<int>    type5;
    typedef A<T>::N<int> type6;
};
--------------------------------------
pr9634.cpp:10: error: ISO C++ forbids declaration of `Bar' with no type
pr9634.cpp:10: error: expected `;'
pr9634.cpp:11: error: ISO C++ forbids declaration of `Bar' with no type
pr9634.cpp:11: error: expected `;'
pr9634.cpp:14: error: `N<int>' specified as declarator-id
pr9634.cpp:14: error: expected `;'
pr9634.cpp:15: error: `N<int>' specified as declarator-id
pr9634.cpp:15: error: expected `;'

The code is legal and should be accepted by GCC. It's rejected from 3.4
(which first disables the implicit typename/template extensions).

NOTE for the fixer: I suggest to prepare a testcase using the official
examples present in the above link, which tests all the conditions for both
success and failure.

Giovanni Bajo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]