|
Boost : |
Subject: Re: [boost] [xpressive] Compiler error on VC7.1
From: Robert Dailey (rcdailey.lists_at_[hidden])
Date: 2012-05-17 16:58:28
BUMP
On Tue, May 15, 2012 at 12:05 PM, Robert Dailey <rcdailey.lists_at_[hidden]>wrote:
> Has anyone been able to reproduce the issue via the sample I've provided
> below? Simply paste the code in a new CPP file in Visual Studio .NET 2003
> and compile :)
>
> On Mon, May 14, 2012 at 4:53 PM, Robert Dailey <rcdailey.lists_at_[hidden]>wrote:
>
>> Here is a small sample that reproduces the issue. Compile this using
>> Visual Studio .NET 2003 and use Boost v1.49
>>
>> #include <string>
>> #include <boost/xpressive/xpressive.hpp>
>>
>> int test()
>> {
>> std::string _serverName = "MY-MACHINE";
>>
>> using namespace boost::xpressive;
>>
>> { // This breaks
>> sregex r = bos >> _serverName >> (as_xpr(".pushsvcs")|"a");
>> }
>>
>> { // This does NOT break
>> sregex r = bos >> _serverName >> (as_xpr(".pushsvcs")|'a');
>> }
>>
>> { // This does NOT break
>> sregex r = bos >> _serverName >> (as_xpr((char const*)".pushsvcs")|"a");
>> }
>> }
>>
>> On Mon, May 14, 2012 at 12:07 PM, Robert Dailey <rcdailey.lists_at_[hidden]
>> > wrote:
>>
>>> Sorry I sent my last email too soon. Let me provide a more detailed
>>> example.
>>>
>>> This fails to compile:
>>> bos >> _serverName >> (as_xpr(".pushsvcs")|".access")
>>>
>>> But this compiles just fine (if I add an as_xpr() wrapper around
>>> ".access"):
>>> bos >> _serverName >> (as_xpr(".pushsvcs")|as_xpr(".access"))
>>>
>>> This is odd... shouldn't the former work just fine? It doesn't fail to
>>> compile on MSVC v9
>>>
>>>
>>> On Mon, May 14, 2012 at 12:05 PM, Robert Dailey <
>>> rcdailey.lists_at_[hidden]> wrote:
>>>
>>>> The problem appears to be with as_xpr(). If I don't use it, it compiles
>>>> fine.
>>>>
>>>>
>>>> On Mon, May 14, 2012 at 11:38 AM, Robert Dailey <
>>>> rcdailey.lists_at_[hidden]> wrote:
>>>>
>>>>> _serverName is a std::string.
>>>>>
>>>>> I wish I could better understand the compiler error, I just don't know
>>>>> for sure if it's a problem with my own code or an incompatibility with
>>>>> boost & MSVC7.1
>>>>>
>>>>>
>>>>> On Fri, May 11, 2012 at 1:51 PM, Eric Niebler <eric_at_[hidden]>wrote:
>>>>>
>>>>>> I just tried the below code on VC++ 2003 (7.1) and was unable to
>>>>>> reproduce your error. (I assume _serverName is of type sregex?) I'm
>>>>>> afraid I don't know what to tell you. Perhaps if you could give me a
>>>>>> complete repro scenario, I might be able to help.
>>>>>>
>>>>>>
>>>>>> On 5/11/2012 9:56 AM, Robert Dailey wrote:
>>>>>> > Anyone have an idea on this issue? It's currently blocking me from
>>>>>> checking
>>>>>> > in this code to source control, since the code absolutely must work
>>>>>> on MSVC
>>>>>> > 7.1 :-(
>>>>>> >
>>>>>> > On Thu, May 10, 2012 at 4:45 PM, Robert Dailey <
>>>>>> rcdailey.lists_at_[hidden]>wrote:
>>>>>> >
>>>>>> >> Hi,
>>>>>> >>
>>>>>> >> I'm using Boost 1.49 Xpressive on VC7.1. When I compile the
>>>>>> following
>>>>>> >> code, I get compiler errors (these do not appear on VC9):
>>>>>> >>
>>>>>> >> sregex const& rex = bos >> _serverName >> !as_xpr("_GWDomino") >>
>>>>>> >> ".diagnostics" >> *(as_xpr(".base")|".renamed");
>>>>>> >>
>>>>>> >> 'rex' is really a function parameter in my real world use case. I'm
>>>>>> >> passing the entire static regex into a function that takes a
>>>>>> 'sregex
>>>>>> >> const&'. I get the compiler error below. Anyone know why this is
>>>>>> happening?
>>>>>> >>
>>>>>> >>
>>>>>> >>
>>>>>> C:\Code\work\cmake-decomp\build-vc7\third_party\boost\1.49.0-stlport-5.2.1\include\boost\proto\traits.hpp(691)
>>>>>> >> : error C2664:
>>>>>> 'boost::proto::exprns_::expr<Tag,Args,Arity>::expr(const
>>>>>> >> boost::proto::exprns_::expr<Tag,Args,Arity> &)' : cannot convert
>>>>>> parameter
>>>>>> >> 1 from
>>>>>> >>
>>>>>> 'boost::proto::detail::as_expr<T,Generator,WantsBasicExpr>::result_type' to
>>>>>> >> 'const boost::proto::exprns_::expr<Tag,Args,Arity> &'
>>>>>> >> with
>>>>>> >> [
>>>>>> >> Tag=boost::proto::tagns_::tag::terminal,
>>>>>> >>
>>>>>> >>
>>>>>> Args=boost::proto::argsns_::term<boost::proto::detail::as_expr<const char
>>>>>> >>
>>>>>> [10],boost::proto::detail::base_generator<boost::proto::default_generator>::type,false>::value_type>,
>>>>>> >> Arity=0
>>>>>> >> ]
>>>>>> >> and
>>>>>> >> [
>>>>>> >> T=const char [10],
>>>>>> >>
>>>>>> >>
>>>>>> Generator=boost::proto::detail::base_generator<boost::proto::default_generator>::type,
>>>>>> >> WantsBasicExpr=false
>>>>>> >> ]
>>>>>> >> and
>>>>>> >> [
>>>>>> >> Tag=boost::proto::tagns_::tag::terminal,
>>>>>> >>
>>>>>> >>
>>>>>> Args=boost::proto::argsns_::term<boost::proto::detail::as_expr<const char
>>>>>> >>
>>>>>> [10],boost::proto::detail::base_generator<boost::proto::default_generator>::type,false>::value_type>,
>>>>>> >> Arity=0
>>>>>> >> ]
>>>>>> >> Reason: cannot convert from
>>>>>> >>
>>>>>> 'boost::proto::detail::as_expr<T,Generator,WantsBasicExpr>::result_type' to
>>>>>> >> 'const boost::proto::exprns_::expr<Tag,Args,Arity>'
>>>>>> >> with
>>>>>> >> [
>>>>>> >> T=const char [10],
>>>>>> >>
>>>>>> >>
>>>>>> Generator=boost::proto::detail::base_generator<boost::proto::default_generator>::type,
>>>>>> >> WantsBasicExpr=false
>>>>>> >> ]
>>>>>> >> and
>>>>>> >> [
>>>>>> >> Tag=boost::proto::tagns_::tag::terminal,
>>>>>> >>
>>>>>> >>
>>>>>> Args=boost::proto::argsns_::term<boost::proto::detail::as_expr<const char
>>>>>> >>
>>>>>> [10],boost::proto::detail::base_generator<boost::proto::default_generator>::type,false>::value_type>,
>>>>>> >> Arity=0
>>>>>> >> ]
>>>>>> >> No constructor could take the source type, or constructor
>>>>>> overload
>>>>>> >> resolution was ambiguous
>>>>>> >>
>>>>>> >>
>>>>>> \Code\work\cmake-decomp\server\exchange\tools\uploadlog\uploader.cpp(1372)
>>>>>> >> : see reference to function template instantiation 'const
>>>>>> >> boost::add_const<T>::type
>>>>>> boost::proto::functional::as_expr<>::operator
>>>>>> >> ()<char,10>(const char (&)[10]) const' being compiled
>>>>>> >> with
>>>>>> >> [
>>>>>> >> T=boost::proto::detail::as_expr<const char
>>>>>> >>
>>>>>> [10],boost::proto::detail::base_generator<boost::proto::default_generator>::type,false>::result_type
>>>>>> >> ]
>>>>>> >>
>>>>>> >
>>>>>> > _______________________________________________
>>>>>> > Unsubscribe & other changes:
>>>>>> http://lists.boost.org/mailman/listinfo.cgi/boost
>>>>>> >
>>>>>>
>>>>>> --
>>>>>> Eric Niebler
>>>>>> BoostPro Computing
>>>>>> http://www.boostpro.com
>>>>>>
>>>>>> _______________________________________________
>>>>>> Unsubscribe & other changes:
>>>>>> http://lists.boost.org/mailman/listinfo.cgi/boost
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk