public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* g++: change in behaviour since gcc-2.95.2
@ 1999-12-21  2:25 Martin Reinecke
  1999-12-21  4:54 ` Martin v. Loewis
  1999-12-31 23:54 ` Martin Reinecke
  0 siblings, 2 replies; 4+ messages in thread
From: Martin Reinecke @ 1999-12-21  2:25 UTC (permalink / raw)
  To: gcc

Consider the following code snippet:

class MSG_STREAM
  {
  public:
    template<typename T> MSG_STREAM &operator<< (const T &data) {}
  };

MSG_STREAM *simple_manip (MSG_STREAM &blah) {}

int main()
  {
  MSG_STREAM foo;
  foo << 5 << simple_manip;
  }

gcc 2.95.2 compiles this without complaints, while the current CVS version says

test.cc: In function `int main ()':
test.cc:12: no match for `MSG_STREAM & << MSG_STREAM *(&) (MSG_STREAM &)'

Is this new behaviour according to the standard? If so, could you please point
me to some information why pointers to functions cannot be used as template
parameter types?

Thanks in advance,
  Martin

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

* Re: g++: change in behaviour since gcc-2.95.2
  1999-12-21  2:25 g++: change in behaviour since gcc-2.95.2 Martin Reinecke
@ 1999-12-21  4:54 ` Martin v. Loewis
  1999-12-31 23:54   ` Martin v. Loewis
  1999-12-31 23:54 ` Martin Reinecke
  1 sibling, 1 reply; 4+ messages in thread
From: Martin v. Loewis @ 1999-12-21  4:54 UTC (permalink / raw)
  To: martin; +Cc: gcc

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 622 bytes --]

> Is this new behaviour according to the standard? If so, could you
> please point me to some information why pointers to functions cannot
> be used as template parameter types?

I'm not entirely sure, but I believe this is due to 14.8.2/2

# Type deduction may fail for the following reasons:
# ...
#  - Attempting to create a cv­qualified function type.

Of course, this is not exactly the right place, since we have no
explicit template arguments, but deduction. The apparent intent is
that it applies to the deduced arguments as well, since there are no
cv-qualified function types in C++.

Hope this helps,
Martin

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

* Re: g++: change in behaviour since gcc-2.95.2
  1999-12-21  4:54 ` Martin v. Loewis
@ 1999-12-31 23:54   ` Martin v. Loewis
  0 siblings, 0 replies; 4+ messages in thread
From: Martin v. Loewis @ 1999-12-31 23:54 UTC (permalink / raw)
  To: martin; +Cc: gcc

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 622 bytes --]

> Is this new behaviour according to the standard? If so, could you
> please point me to some information why pointers to functions cannot
> be used as template parameter types?

I'm not entirely sure, but I believe this is due to 14.8.2/2

# Type deduction may fail for the following reasons:
# ...
#  - Attempting to create a cv­qualified function type.

Of course, this is not exactly the right place, since we have no
explicit template arguments, but deduction. The apparent intent is
that it applies to the deduced arguments as well, since there are no
cv-qualified function types in C++.

Hope this helps,
Martin

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

* g++: change in behaviour since gcc-2.95.2
  1999-12-21  2:25 g++: change in behaviour since gcc-2.95.2 Martin Reinecke
  1999-12-21  4:54 ` Martin v. Loewis
@ 1999-12-31 23:54 ` Martin Reinecke
  1 sibling, 0 replies; 4+ messages in thread
From: Martin Reinecke @ 1999-12-31 23:54 UTC (permalink / raw)
  To: gcc

Consider the following code snippet:

class MSG_STREAM
  {
  public:
    template<typename T> MSG_STREAM &operator<< (const T &data) {}
  };

MSG_STREAM *simple_manip (MSG_STREAM &blah) {}

int main()
  {
  MSG_STREAM foo;
  foo << 5 << simple_manip;
  }

gcc 2.95.2 compiles this without complaints, while the current CVS version says

test.cc: In function `int main ()':
test.cc:12: no match for `MSG_STREAM & << MSG_STREAM *(&) (MSG_STREAM &)'

Is this new behaviour according to the standard? If so, could you please point
me to some information why pointers to functions cannot be used as template
parameter types?

Thanks in advance,
  Martin

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

end of thread, other threads:[~1999-12-31 23:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-21  2:25 g++: change in behaviour since gcc-2.95.2 Martin Reinecke
1999-12-21  4:54 ` Martin v. Loewis
1999-12-31 23:54   ` Martin v. Loewis
1999-12-31 23:54 ` Martin Reinecke

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).