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]

c++/7412: References to references (DR 106)


>Number:         7412
>Category:       c++
>Synopsis:       References to references (DR 106)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 26 01:26:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang Bangerth
>Release:        unknown-1.0
>Organization:
>Environment:
every gcc version up to 2002/07/17 at least
>Description:
The C++ standard in its wording prohibits
reference-to-reference types, but this is subject to DR 106 
(unfortunately not yet in "ready" state, so someone may want 
to suspend this bug report for the time being). Since it is
so simple to create situations where this hurts badly (see
attached example), I thought I'd file a report for this.

Regards
  Wolfgang


Here's the test case:
-----------------------------------------
#include <functional>
void foo (const int &i, const int &j);
int main () {
  std::bind2nd (std::ptr_fun (&foo), 1);
};
-----------------------------------------
The error messages are lengthy, but the essence is that you 
cannot bind reference arguments to functions, even if they
are constant, although I think that would be a perfectly
reasonable idea if the object you want to bind is largish,
or cannot be copied.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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