This is the mail archive of the gcc-prs@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++/5786: array template argument deduction from temporary



>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:


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