Microsoft KB Archive/315946

= BUG: You receive error message C1001 when you try to convert the managed parameter constructor std::string& to std::string in Viosual Studio .NET =

Article ID: 315946

Article Last Modified on 8/24/2005

-

APPLIES TO


 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Academic Edition
 * Microsoft Visual Studio .NET 2003 Academic Edition
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Professional Edition

-



This article was previously published under Q315946



SYMPTOMS
In Microsoft Visual Studio .NET, when you try to convert the managed parameter constructor std::string& to std::string, you receive the following error message:

&quot;fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'f:\vs70builds\9288\vc\Compiler\Utc\src\P2\main.c', line 146)&quot;



RESOLUTION
Change the constructor so that it requires its argument to be copy constructed.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce the Behavior
  Create a Managed Extensions for C++ application named Test. Delete the existing code in Test.cpp, and then paste the following sample code: /* test.cpp*/


 * 1) include &quot;stdafx.h&quot;

public __gc class Hello { public: Hello(std::string arg) {} };
 * 1) using 
 * 2) include

public __gc class There { public: void Something(const std::string &arg) { Hello *hello = new Hello(arg); } };

void main { There *there = new There; there->Something(&quot;world&quot;); }                    Do one of the following:  Use the integrated development environment (IDE) to build the project.

-or- Compile the file in Visual Studio .NET by typing the following at a command prompt: cl /clr /EHsc test.cpp  </li></ol>

Keywords: kbbug kbpending kbvs2002sp1sweep KB315946

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.