This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/17207] New: No warning for nonsense template
- From: "igodard at pacbell dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Aug 2004 07:30:15 -0000
- Subject: [Bug c++/17207] New: No warning for nonsense template
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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