[Bug c++/45341] New: Compiler error matching template function with array reference parameter to anonimous struct array

2010-08-19 Thread dev at sogetthis dot com
// gcc 4.5
// error: no matching function for call to 'func( [5])'
// Adding name to struct fixes the error

template
void func (T(&)[N]);

struct
{
int i;
}
arr[5];

void test()
{
func(arr);
}


-- 
   Summary: Compiler error matching template function with array
reference parameter to anonimous struct array
   Product: gcc
   Version: 4.5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: dev at sogetthis dot com


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



[Bug c++/45341] Compiler error matching template function with array reference parameter to anonimous struct array

2010-08-19 Thread dev at sogetthis dot com


--- Comment #3 from dev at sogetthis dot com  2010-08-19 15:27 ---
I just found out that it does compile successfully with -std=c++0x flag.

In C++03, unnamed type shall not be used as a template-argument for a template
type-parameter (irrespective of it's linkage). In C++0x this restriction has
been removed.

See 14.3.1 Template type arguments


-- 


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