Boost logo

Boost :

From: Marco Oman (nimaca2001_at_[hidden])
Date: 2003-08-26 01:47:35


On Mon, 25 Aug 2003 14:31:07 +1000, Chris Trengove
<trengove_at_[hidden]> wrote:

> At the moment, Boost.Regex has an incompatibility with the VCL headers
> when
> compiling with Borland C++ 5.5. Simply having
>
> #include <vcl.h>
> #include <boost\regex.hpp>
>
> generates a large number of errors of the type.
>
> [C++ Error] cregex.hpp(91): E2015 Ambiguity between '_fastcall operator
> |(int,const Variant &)' and '|'
>
> I'm afraid that I have yet to track down the precise cause of the errors,
> or
> a solution.
>

I had once a problem like the one described and was due to the operator|()
being overloaded for an enum type. (compiler: BCB 5.5.1)

For example the code below

//-----Start of code
enum SquareAngle
{
    Rotate0,
    Rotate90,
    Rotate180,
    Rotate270,
    Rotate360
} ;

SquareAngle operator*(SquareAngle lhs, SquareAngle rhs)
{
    return static_cast<SquareAngle>((static_cast<int>(lhs) +
                                     static_cast<int>(rhs)) %
static_cast<int>(Rotate360)) ;
}

#include <vcl.h>
#pragma hdrstop

#include "OperatorOverloadForm.h"
//--------------------------------------------------------------------------
-
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;

//--------------------------------------------------------------------------
-
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//----End of code

produces the following error:

[C++ Error] sysset.h(24): E2015 Ambiguity between '_fastcall operator
/(int,const Currency &)' and '/'

plus others...

Any workarounds? I sbstituted the operator*() with a normal function...


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk