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]

[Bug c++/16106] New: Poor error message


template<typename T>
struct A {
        A(T& t = T()) : tt(t) {}
    T&  tt;
    };

int main() {
    A<int> a;
    return 0;
    }


gives:

~/ootbc/common/test/src$ g++ foo.cc
foo.cc: In function `int main()':
foo.cc:8: error: default argument for parameter of type `int&' has type `int'


A sample better message is:

Comeau C/C++ 4.3.3 (Aug  6 2003 15:13:37) for ONLINE_EVALUATION_BETA1
Copyright 1988-2003 Comeau Computing.  All rights reserved.
MODE:strict errors C++

"ComeauTest.c", line 3: error: initial value of reference to non-const must be an
          lvalue
          A(T& t = T()) : tt(t) {}
                   ^
          detected during instantiation of "A<T>::A(T &) [with T=int]" at line
                    8

1 error detected in the compilation of "ComeauTest.c".

-- 
           Summary: Poor error message
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


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