c++/5786: array template argument deduction from temporary

david.abrahams@rcn.com david.abrahams@rcn.com
Tue Feb 26 12:00:00 GMT 2002


>Number:         5786
>Category:       c++
>Synopsis:       array template argument deduction from temporary
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 26 09:06:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     David Abrahams
>Release:        3.0.3
>Organization:
>Environment:
Cygwin
>Description:
Various kinds of array argument deduction from temporaries fails. Some fraction of this may be correct behavior; EDG rejects most of these, too.

-Dave
>How-To-Repeat:
Compile the following:
template <class T, unsigned N>
void print1(T const (&x)[N])
{
}

template <class T, unsigned N, unsigned M>
void print2(T const (&x)[N][M])
{
}

template <class T, unsigned N>
void print3(T const(*x)[N])
{
}

template <class T, unsigned N>
void print4(T (*x)[N])
{
}

struct X { int x[2][4]; };

int main()
{
   print1(X().x);
   print2(X().x);
   print3(&X().x);
   print4(&X().x);
   return 0;
}
>Fix:

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



More information about the Gcc-bugs mailing list