public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/29427] New: uncallable constructor template should be warned.
@ 2006-10-11 5:36 igodard at pacbell dot net
2006-10-15 2:58 ` [Bug c++/29427] " pinskia at gcc dot gnu dot org
2009-12-08 20:45 ` redi at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: igodard at pacbell dot net @ 2006-10-11 5:36 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1117 bytes --]
class foo {
public:
template<typename T>
foo(int i) : j(i) {}
template<typename T>
void bar(int i) { j = i; }
template<typename T>
static
void baz(int i) {}
int j;
};
int main() {
foo::baz<bool>(3);
foo* p; p->bar<bool>(3);
new foo<bool>(3);
return 0;
}
gets you:
~/ootbc/chips$ g++ foo.cc
foo.cc: In function âint main()â:
foo.cc:8: error: âfooâ is not a template
foo.cc:8: error: no matching function for call to âfoo::foo(int)â
foo.cc:1: note: candidates are: foo::foo(const foo&)
The problem is that the constructor was declared as a template, hence cannot be
called (see bug# 29008). This can be detected at the declaration and a warning
should issue.
OK.
--
Summary: uncallable constructor template should be warned.
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: igodard at pacbell dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29427
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/29427] uncallable constructor template should be warned.
2006-10-11 5:36 [Bug c++/29427] New: uncallable constructor template should be warned igodard at pacbell dot net
@ 2006-10-15 2:58 ` pinskia at gcc dot gnu dot org
2009-12-08 20:45 ` redi at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-15 2:58 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29427
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/29427] uncallable constructor template should be warned.
2006-10-11 5:36 [Bug c++/29427] New: uncallable constructor template should be warned igodard at pacbell dot net
2006-10-15 2:58 ` [Bug c++/29427] " pinskia at gcc dot gnu dot org
@ 2009-12-08 20:45 ` redi at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu dot org @ 2009-12-08 20:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from redi at gcc dot gnu dot org 2009-12-08 20:45 -------
diagnosing this would be useful and shouldn't require instantiation, it should
be detectable during phase 1
reduced:
struct foo {
template<typename T> foo(int);
};
--
redi at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |diagnostic
Known to fail| |4.4.2
Last reconfirmed|0000-00-00 00:00:00 |2009-12-08 20:45:06
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29427
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-12-08 20:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-11 5:36 [Bug c++/29427] New: uncallable constructor template should be warned igodard at pacbell dot net
2006-10-15 2:58 ` [Bug c++/29427] " pinskia at gcc dot gnu dot org
2009-12-08 20:45 ` redi at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).