none
Variadic friend class function causing internal error RRS feed

  • Question

  • I am trying to make a variadic function a friend to another class, the issue however is that it causes an internal error. Here is the replicable minimalistic test code:

    class foo{
    	template <class T, typename ... Args >
    	void add(Args&&... args){
    	}
    };
    
    class bar{
    	template <class T, typename ... Args >
    	friend void foo::add(Args &&... args);
    };
    
    int main(){
    	return 0;
    }

    • Moved by Anna Cc Tuesday, June 3, 2014 8:35 AM
    Monday, June 2, 2014 7:40 PM

Answers

  • This error indicates a bug in the compiler. Before we can push a fix for it, try below workaround:

    1. Write down the source file name which fired the error. In your test project, it's source.cpp
    2. Go to VS solution explorer, navigate to source files folder, create a subfolder with any name, move source.cpp over here
    3. Rebuild

    The above method modified the build order, but should be OK. As to how the bug can happen you can refer to this KB: http://support.microsoft.com/kb/305980 the solutions in KB not necessarily to fix that problem.

    Finally, to get this problem investigated and fixed, you can log a bug at connect. However this is optional. http://connect.microsoft.com/VisualStudio/


    Remember to mark reply as answer if it answers the question.
    Apps Request

    • Marked as answer by Anna Cc Wednesday, June 11, 2014 9:37 AM
    Tuesday, June 3, 2014 5:46 AM

All replies

  • Hey,

    Would you share with me what the internal error do you see? It's important to follow up.

    At the same time, to work with friend function, you can refer to this document: http://www.cplusplus.com/doc/tutorial/inheritance/ Your test code looks OK in terms of friend function though.


    Remember to mark reply as answer if it answers the question.
    Apps Request

    Tuesday, June 3, 2014 3:40 AM
  • Sure

    1>e:\programs\test project\test project\source.cpp(12): fatal error C1001: An internal error has occurred in the compiler.
    1>  (compiler file 'msc1.cpp', line 1325)
    1>   To work around this problem, try simplifying or changing the program near the locations listed above.
    1>  Please choose the Technical Support command on the Visual C++ 
    1>   Help menu, or open the Technical Support help file for more information
    1>  INTERNAL COMPILER ERROR in 'E:\Microsoft Visual Studio 12.0\VC\bin\CL.exe'
    1>      Please choose the Technical Support command on the Visual C++
    1>      Help menu, or open the Technical Support help file for more information



    • Edited by Yelnats321 Tuesday, June 3, 2014 4:11 AM
    Tuesday, June 3, 2014 4:11 AM
  • This error indicates a bug in the compiler. Before we can push a fix for it, try below workaround:

    1. Write down the source file name which fired the error. In your test project, it's source.cpp
    2. Go to VS solution explorer, navigate to source files folder, create a subfolder with any name, move source.cpp over here
    3. Rebuild

    The above method modified the build order, but should be OK. As to how the bug can happen you can refer to this KB: http://support.microsoft.com/kb/305980 the solutions in KB not necessarily to fix that problem.

    Finally, to get this problem investigated and fixed, you can log a bug at connect. However this is optional. http://connect.microsoft.com/VisualStudio/


    Remember to mark reply as answer if it answers the question.
    Apps Request

    • Marked as answer by Anna Cc Wednesday, June 11, 2014 9:37 AM
    Tuesday, June 3, 2014 5:46 AM
  • Hi,

    I help move this case to Visual C++ forum for better response.

    Thank you for your understanding!

    Best regards,

    Tuesday, June 3, 2014 8:36 AM