Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

compiler bug -- mistaken C3821 when invoking new in ctor-initializer-list (regression)

8 views
Skip to first unread message

Ben Voigt [C++ MVP]

unread,
Jul 8, 2009, 6:02:11 PM7/8/09
to

Please validate this bug:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=473352

Here is the test case:

#pragma managed(push, off)
#include <list>

class C3821
{
std::list<int*>* p;

public:
C3821( size_t n )
: p(new std::list<int*>[n])
{
}
};
#pragma managed(pop)

I've been able to verify that it works in VS2005 SP1 but not in VS2008 SP1,
appreciate anyone who can check it on RTM versions or has VS2010 beta handy.


Jeroen Mostert

unread,
Jul 8, 2009, 6:32:41 PM7/8/09
to
VS 2010 output:

1>ClCompile:
1> c3821.cpp
1>c3821.cpp(9): error C2711: 'C3821::C3821' : this functon cannot be
compiled as managed, consider using #pragma unmanaged
1> #pragma unmanaged is in effect
1> c3821.cpp(11) : see source of the previous compiler diagnostic
1>c3821.cpp(12): error C3821: 'C3821::C3821(size_t)': managed type or
function cannot be used in an unmanaged function

So you have to use #pragma unmanaged, which also happens to be in effect, so
the error is obvious, right? (And yes, this is verbatim output, it's
"functon" -- well, it's a beta.)

--
J.

Ben Voigt [C++ MVP]

unread,
Jul 9, 2009, 10:11:18 AM7/9/09
to

Beta status is no excuse when that identical error message and (mis)spelling
is produced by the VS2008 SP1 compiler ;)

C2711 is confusing because unmanaged mode is selected. But I think it is
produced as a side effect of the C3821. It's trying to recover from C3821
by compiling the code to MSIL instead of native, and my pragma forbids that,
hence the C2711.

The issue is C3821. There is no use of any managed type, and the error
message makes no attempt to explain which type or function the compiler
thought was being used.


Jialiang Ge [MSFT]

unread,
Jul 10, 2009, 6:49:32 AM7/10/09
to

Hello Ben

I looked up the issue in the product database. The issue is active in the
Visual Studio 2010 issue DB. The product group is aware of it and is in
progress of researching it. I will convey your comments above to the team.

Regards,
Jialiang Ge
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msd...@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================

Ben Voigt [C++ MVP]

unread,
Jul 12, 2009, 11:53:50 AM7/12/09
to

""Jialiang Ge [MSFT]"" <jia...@online.microsoft.com> wrote in message
news:3mbzlwUA...@TK2MSFTNGHUB02.phx.gbl...


> Hello Ben
>
> I looked up the issue in the product database. The issue is active in the
> Visual Studio 2010 issue DB. The product group is aware of it and is in
> progress of researching it. I will convey your comments above to the team.

Thanks. I just wish I had encountered this before the VS2010 bug bar got
raised, now it probably can't be fixed until VS.next.

>
> Regards,
> Jialiang Ge
> Microsoft Online Community Support
>
> =================================================
> Delighting our customers is our #1 priority. We welcome your comments and
> suggestions about how we can improve the support we provide to you. Please
> feel free to let my manager know what you think of the level of service
> provided. You can send feedback directly to my manager at:
> msd...@microsoft.com.
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> =================================================
>
>

> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4236 (20090712) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4236 (20090712) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

0 new messages