Bug 29522 - [4.0 Regression] rejects valid template argument
Summary: [4.0 Regression] rejects valid template argument
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.4
: P3 normal
Target Milestone: 4.0.4
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2006-10-20 07:23 UTC by Andrew Pinski
Modified: 2007-02-03 20:44 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.2.3 4.1.2 4.2.0
Known to fail: 4.0.4
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2006-10-20 07:23:04 UTC
Testcase:
template< int C > int assertion_failed( int);
template< class >
struct N
{
  static int const okay = 1;
  static int const
    t = sizeof( assertion_failed<okay>( 0))
  ;
};
int main()
{
  N<int> n;
  return n.t;
}
Comment 1 Andrew Pinski 2006-10-20 07:24:20 UTC
Note I could not find this bug filed so I filed it.  Also note I found it while looking at PR 29518.
Oh and the error message is:
[pinskia@celery ~]$ ~/gcc-4.0/bin/gcc t.cc
t.cc: In instantiation of ‘const int N<int>::t’:
t.cc:13:   instantiated from here
t.cc:7: error: ‘N<int>::okay’ is not a valid template argument for type ‘int’ because it is a non-constant expression
t.cc:7: error: no matching function for call to ‘assertion_failed(int)’
Comment 2 Gabriel Dos Reis 2007-02-03 20:44:00 UTC
won't fix in GCC-4.0.x.