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

  • Home
  • SEARCH
  • 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 308739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:40:41+00:00 2026-05-12T07:40:41+00:00

I’m looking at some codes which makes heavy uses of templates. It compiles fine

  • 0

I’m looking at some codes which makes heavy uses of templates. It compiles fine on GCC, but not on VS (tested on 2003 – 2010 beta 1), where it fails during syntax analysis. Unfortunately I don’t know enough of the code structure to be able reduce the problem and reproduce it in only a few lines, so I can only guess at the cause. I’m hoping someone here can point me in the right direction.

We have

template< class UInt, typename IntT,
    bool is_signed = std::numeric_limits<IntT>::is_signed >
struct uii_ops_impl;

// ....

template<class UInt>
struct uii_ops_impl< UInt,
    typename make_signed<typename UInt::digit_type>::type, true >
{
    typedef UInt unbounded_int_type;
    typedef typename make_signed< typename unbounded_int_type::digit_type >::type
        integral_type;

    // ...

    static void add(unbounded_int_type& lhs, integral_type rhs);

    // ...
};

template<class UInt>
void uii_ops_impl<
    UInt, typename make_signed<typename UInt::digit_type>::type,
    true >::add(unbounded_int_type& lhs, integral_type rhs)
{
    // ....
}

When compiled on VS, the first error message (among many) it returns is

: error C2065: ‘unbounded_int_type‘ : undeclared identifier

I mean, point at the typedef huh? :-S

EDIT:

It seems there’s something to do with

typename make_signed<typename UInt::digit_type>::type

being used as a template parameter. Throughout the rest of the codes, similar typedefs being used in the member function parameter compiles fine. The only difference I can see so far is that none of the other cases have the above line as a template parameter. make_signed is from Boost.TypeTraits.

EDIT:

Okay, maybe that’s not it, because the exact same thing is done in another file where it compiled fine. Hmm…

Bounty EDIT:

Okay, I think it’s obvious at this point the problem is not actually where the compiler is complaining about. Only the two member functions definition at that particular point fail. It turns out that explicitly qualifying the parameter still doesn’t compile. The only immediate solution is to define the function inline. That passes syntax analysis. However, when trying to instalize the template VS now fails because std::allocator<void> doesn’t have a size_type member. Turns out VS have a specialization of std::allocator<T> for T=void that does not declare a size_type. I thought size_type is a required member of all allocators?

So the question now is, what could possibly foul up VS so much during syntax analysis that it complains about completely unrelated non-problem as errors, and how do you debug such codes?

p.s. For those that have too much time to spare, the code I’m trying to make work in VS is Kevin Sopp’s mp_math in Boost’s sandbox, which is based on libtommath.

  • 1 1 Answer
  • 1 View
  • 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-05-12T07:40:41+00:00Added an answer on May 12, 2026 at 7:40 am

    I think this can be caused by a few circumstances

    • unbounded_int_type is a non-dependent type (defined at 14.6.2.1)
    • Its declaration appears in the class template. Because it’s non-dependent, its name has to be resolved to a declaration at the time the member function is defined.

    I suspect that Visual C++ is not able to do this lookup, and errors out instead. As someone else mentions, you can explicitly qualify the type-names in the member function definition. The types are then dependent, and this will trigger the compiler’s mechanism to delay name lookup until instantiation.

    template<class UInt>
    void uii_ops_impl<
        UInt, typename make_signed<typename UInt::digit_type>::type,
        true >::add(typename
                    /* repeat-that-beast uii_ops...true> here */
                       ::unbounded_int_type& lhs, 
                    typename /* and here too */::integral_type rhs)
    {
        // ....
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I have some data like this: 1 2 3 4 5 9 2 6

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.