public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21661] New: Inconsistent function/constructor template requirements
@ 2005-05-19  9:40 igodard at pacbell dot net
  2005-05-19 12:02 ` [Bug c++/21661] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: igodard at pacbell dot net @ 2005-05-19  9:40 UTC (permalink / raw)
  To: gcc-bugs

In:

template<typename T, typename U>
void    foo(U u) {}

template<typename T, typename U>
struct bar {
            bar(U u) {}
    };

int main() {
    foo<int>(true);
    bar<int>(true);
    }

you get:

foo.cc: In function `int main()':
foo.cc:11: error: wrong number of template arguments (1, should be 2)
foo.cc:5: error: provided for `template<class T, class U> struct bar'

Shouldn't both the call and the constructor require two args, or both require
only one? I thought constructors resolved like functions.

Ivan

-- 
           Summary: Inconsistent function/constructor template requirements
           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=21661


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/21661] Inconsistent function/constructor template requirements
  2005-05-19  9:40 [Bug c++/21661] New: Inconsistent function/constructor template requirements igodard at pacbell dot net
@ 2005-05-19 12:02 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-19 12:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-19 12:02 -------
This is how C++ works, in the first case since it is a function template, the second template argument 
can be determined by the function argument.

In the second example, the class template's template arguments cannot be determined by any 
explicated way.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-05-19 12:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-19  9:40 [Bug c++/21661] New: Inconsistent function/constructor template requirements igodard at pacbell dot net
2005-05-19 12:02 ` [Bug c++/21661] " pinskia 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).