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++/17207] New: No warning for nonsense template


struct D{};
template<typename T>
D& Foo(D& d) { return d;}
int main() {
    D d;
    Foo(d);
    return 0;
    }

gets you:

~/ootbc/common/test/src$ g++ foo1.cc
foo1.cc: In function `int main()':
foo1.cc:6: error: no matching function for call to `Foo(D&)'


which is dine - but if you take out the call then it compiles. As the function can *never* be called the declaration is nonsense and should be flagged at declaration.

Ivan

-- 
           Summary: No warning for nonsense template
           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=17207


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