On mainline I get a hosed error message for the following invalid code
snippet:

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

template<int N> void foo(const A<N> &a) { -A<N>(a); }

void bar()
{
    foo(A<0>());
}
========================================================

The error message reads:

  bug.cc: In function 'void foo(const A<N>&) [with int N = 0]':
  bug.cc:7:   instantiated from here
  bug.cc:3: error: no match for 'operator-' in '-((const A<0>&)#'convert_expr'
not supported by dump_expr#<expression error>)'

With gcc 4.0.0 I get the following message instead:

  bug.cc: In function 'void foo(const A<N>&) [with int N = 0]':
  bug.cc:7:   instantiated from here
  bug.cc:3: error: no match for 'operator-' in '-((const A<0>&)(+ a))'

I don't know why the plus sign appears before "a", but this suggests that
the regression is related to the recent introduction of UNARY_PLUS_EXPR:
http://gcc.gnu.org/ml/gcc-patches/2005-05/msg02580.html

-- 
           Summary: [4.1 regression] pretty printer confusion
           Product: gcc
           Version: 4.1.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,giovannibajo at gcc dot
                    gnu dot org,roger at eyesopen dot com


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

Reply via email to