Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8567955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:59:53+00:00 2026-06-11T17:59:53+00:00

Recently, I tested some template code on Codepad. Althought the code is correct, GCC

  • 0

Recently, I tested some template code on Codepad. Althought the code is correct, GCC is giving me a really strange error. I also tested it on Ideone:

Tested code:

template<int num>
struct count;

template<>
struct count<-1>
{
};

int main()
{
 return 0;
}

Here are the results, on Codepad (GCC 4.1.2) and Ideone (GCC 4.3.4) : GCC 4.1.2 outputs:

Line 5: error: 'count' is not a template

while GCC 4.3.4 compiles normally without errors.
Is this really a compiler bug, or is my code not correct (and compile thanks to extensions?)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:59:54+00:00Added an answer on June 11, 2026 at 5:59 pm

    If I try

    template<int num>
    struct count;
    
    template<>
    struct count<-1>
    {
    };
    
    int main()
    {
     return 0;
    }
    

    with g++ 4.1.2, I don’t have a problem. If I try

    #include <algorithm>
    using namespace std;
    
    template<int num>
    struct count;
    
    template<>
    struct count<-1>
    {
    };
    
    int main()
    {
     return 0;
    }
    

    with g++ -Wfatal-errors I get

    count.cpp:8: error: 'count' is not a template
    compilation terminated due to -Wfatal-errors.
    

    So my guess is that Codepad is forcing a preamble on you which triggers the error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was recently found a strange behavior in IE9(haven't tested under IE8): http://jsfiddle.net/qktfq/5/ Remove
I'm working with some SQL 2005 CLR code written in C#. We have recently
I recently refactored some code in an Active Directory role provider to remove support
I recently tested my site on Safari and for some odd reason it only
I've recently (2 weeks ago) tested successfully the In-App Pruchase functionality with some iPad
I've recently started using code coverage tools (particularily Emma and EclEmma), and I really
In one of my MVC3 web applications I have recently noticed some strange looking
I've been developing using Sharepoint 2007 on a VM, and recently tested some functionality
I recently created a WCF service that works fine when tested from Visual Studio
I've been working on some solutions for some questions that have been recently posted

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.