Bug 62223 - error: there are no arguments to ‘static_asssert’ that depend on a template parameter, so a declaration of ‘static_asssert’ must be available
Summary: error: there are no arguments to ‘static_asssert’ that depend on a template p...
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.9.0
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-22 07:25 UTC by tower120
Modified: 2014-08-23 23:01 UTC (History)
1 user (show)

See Also:
Host:
Target:
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 tower120 2014-08-22 07:25:33 UTC
May be not a bug... But, why error occurs in the following code?

#include <tuple>
#include <utility>
using namespace std;

template<class ..._Attrs>
class VertexBuffer
{
    static constexpr const bool ownIndices = sizeof...(_Attrs) == 0;
    
    void test(){
        static_asssert(ownIndices, "Link to owned indices!!");        
    }
}


int main(){}

error: there are no arguments to 'static_asssert' that depend on a template parameter, so a declaration of 'static_asssert' must be available [-fpermissive]
         static_asssert(ownIndices, "Link to owned indices!!");
                                                             ^

Doesn't ownIndices template-dependent value?

Compiled with MinGW 4.9
Comment 1 Marc Glisse 2014-08-22 07:56:02 UTC
I am going to take a guess that you forgot to specify -std=c++11 or equivalent?
Comment 2 tower120 2014-08-22 09:54:28 UTC
No, I compile it with -std=c++1y

Here, live example http://ideone.com/KsGrnH (though that is gcc-4.8.1)
Comment 3 Marc Glisse 2014-08-22 10:38:33 UTC
Typo, check the exact spelling of what g++ is complaining about.
Comment 4 tower120 2014-08-22 10:44:35 UTC
Typo indeed.
I'm so sorry.
Comment 5 Manuel López-Ibáñez 2014-08-22 10:49:11 UTC
The spell-checker would have been helpful here. It would have said: did you mean 'static_assert'?
Comment 6 tower120 2014-08-22 17:06:58 UTC
Well, classical "static_asssert is not a function/variable/etc" would be enough for me.

Because "there are no arguments to 'static_asssert' that depend on a template parameter" means that there IS such a function, but it does not accept current parameters set (IMHO).
Comment 7 Jonathan Wakely 2014-08-23 23:01:32 UTC
(In reply to tower120 from comment #6)
> Because "there are no arguments to 'static_asssert' that depend on a
> template parameter" means that there IS such a function, but it does not
> accept current parameters set (IMHO).

No. "A declaration must be available" does not mean "a declaration is available but it is not usable"