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 6352707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:16:27+00:00 2026-05-24T22:16:27+00:00

This should be self explanatory. I’m trying to implement a distribution sort, and the

  • 0

This should be self explanatory. I’m trying to implement a distribution sort, and the MSVC compiler is crashing. It seems to be a specific case to do with my SFINAE to detect a member function, this doesn’t appear to happen if I don’t pass indexert to a function, nor if I replace has_get_index. It also doesn’t happen if I remove either of the remaining indexer overloads. The problem does remain if sortable has a getIndex() const member.

1>test.cpp(34): fatal error C1001: An internal error has occurred in the compiler.
1>  (compiler file 'msc1.cpp', line 1420)
1>   To work around this problem, try simplifying or changing the program near the locations listed above.

(There are no “locations listed above”) A minimal test case is:

#include <vector>
#include <iterator>
#include <type_traits>

#ifndef HAS_MEM_FUNC //SFINAE (or maybe it is?)
#define HAS_MEM_FUNC(name, func)                                        \
    template<typename T>                                                \
    struct name {                                                       \
        typedef char yes[1];                                            \
        typedef char no [2];                                            \
        template <typename C> static yes& test( typename C::func ) ;    \
        template <typename C> static no&  test(...);                    \
        static bool const value = sizeof(test<T>(0)) == sizeof(yes);    \
    }
#endif
HAS_MEM_FUNC(has_get_index,getIndex);

//default indexer undefined
template <class T>
double indexer(...);
//indexer for objects that have a "T::getIndex() const" member
template <class T>
double indexer(const typename std::enable_if<has_get_index<T>::value,T>::type& b) {
    return b.getIndex();
};

template<class indexert> 
void function(indexert indexeri)
{}

struct sortable {};

int main () {
    function(indexer<sortable>); //line 34
}
  • 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-05-24T22:16:28+00:00Added an answer on May 24, 2026 at 10:16 pm

    This probably isn’t what you intended:

    template <typename C> static yes& test( typename C::func ) ;
    

    With typename you tell the compiler that C::func will be a type. In reality it will be a function, and putting a function name there in the parameter declaration doesn’t make any sense.

    Did you maybe intend to use typeof instead of typename?

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

Sidebar

Related Questions

The title of this question should be pretty self explanatory. I am making an
The title of this question should be self explanatory, but basically I have this
I have this bit of code, which should be self explanatory: _item.Distance = Decimal.Round(dDistanceDec,
This should be a very simple case, but I am pulling hair trying to
I have this piece of code (should be self-explanatory; if not, just ask): for
Should be pretty self-explanatory, but this is in the context of real-time XNA code
The Title is self explanatory. This was an interview question. In java, List is
I'll start off with the code as it should be fairly self-explanatory: <commonControls:SearchTextBox x:Name=searchTextBox
Question should be self explanatory. I have a datagridview which has a column whose
This should be a snap for anyone who's done it before... I'm trying to

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.