Bug 35571 - `static function member` cannot appeat in a constant-expression.
Summary: `static function member` cannot appeat in a constant-expression.
Status: RESOLVED DUPLICATE of bug 35167
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
: 35570 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-03-13 15:31 UTC by Pawel Sikora
Modified: 2008-03-14 08:49 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.1.3
Known to fail: 4.2.3 4.3.0
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Sikora 2008-03-13 15:31:57 UTC
template < void ( *F )() >
struct X { };
template < typename T >
struct Y
{
        static void f() { }
        typedef X< f > F;
};
Y< void > test;

$ g++ 0.cpp -c
0.cpp: In instantiation of &#8216;Y<void>&#8217;:
0.cpp:9:   instantiated from here
0.cpp:7: error: &#8216;static void Y<T>::f() [with T = void]&#8217; cannot appear
                in a constant-expression
Comment 1 Pawel Sikora 2008-03-13 15:33:13 UTC
*** Bug 35570 has been marked as a duplicate of this bug. ***
Comment 2 Pawel Sikora 2008-03-13 15:35:21 UTC
4.1.3, msvc8 and comeau accept this code.
Comment 3 Andrew Pinski 2008-03-13 16:36:14 UTC
Doing:
        typedef X<Y:: f > F;


Fixes the error message.
Comment 4 Andrew Pinski 2008-03-13 16:38:12 UTC

*** This bug has been marked as a duplicate of 35167 ***
Comment 5 Pawel Sikora 2008-03-14 08:49:34 UTC
(In reply to comment #3)
> Doing:
>         typedef X<Y:: f > F;
> 
> 
> Fixes the error message.
> 

oh, so the comeau accepts invalid code :-)