Bug 17754 - [3.4 regression] Static member function not accepted as non-type template argument
Summary: [3.4 regression] Static member function not accepted as non-type template arg...
Status: RESOLVED DUPLICATE of bug 17585
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.1
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2004-09-30 17:59 UTC by Ben Hutchings
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: i486-pc-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Hutchings 2004-09-30 17:59:26 UTC
g++ 3.4.1 doesn't accept a static member function as the argument for a non-type
template parameter of the appropriate function type. For example, given:

<code>
template<void (*)()> void tfunc();

struct foo
{
    static void bar();
};

void foo::bar()
{
    tfunc<bar>();
}
</code>

it says:

<error>
In static member function `static void foo::bar()':
error: `static void foo::bar()' cannot appear in a constant-expression
error: template argument 1 is invalid
error: no matching function for call to `tfunc()'
</error>

g++ 3.3.4 accepts the code.
Comment 1 Andrew Pinski 2004-09-30 18:02:37 UTC
This is already fixed in 3.4.3 see dup bug 17585.

*** This bug has been marked as a duplicate of 17585 ***