The diagnostic for the following invalid code snippet could be improved:

=================================
template<typename> struct A {};

namespace N {}

A<N> a;
=================================

On mainline we now get:

bug5.cc:5: error: template argument 1 is invalid
bug5.cc:5: error: template argument 1 is invalid
bug5.cc:5: error: template argument 1 is invalid
bug5.cc:5: error: template argument 1 is invalid
bug5.cc:5: error: template argument 1 is invalid
bug5.cc:5: error: template argument 1 is invalid
bug5.cc:5: error: template argument 1 is invalid
bug5.cc:5: error: template argument 1 is invalid
bug5.cc:5: error: expected constructor, destructor, or type conversion before
'<' token

With 3.3.5 we get:

bug5.cc:5: error: use of namespace `N' as expression
bug5.cc:5: error: template argument 1 is invalid
bug5.cc:5: error: ISO C++ forbids declaration of `a' with no type

which is okay IMHO. With 3.4.3 we get

bug5.cc:5: error: template argument 1 is invalid
bug5.cc:5: error: invalid type in declaration before ';' token

which is less informative, but still okay.
With the current 3.4 branch we almost get the same mess as with mainline.

-- 
           Summary: [3.4/4.0 regression] Bad diagnostic for namespace as
                    template parameter
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: diagnostic, monitored
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19499

Reply via email to