possible bug?! 
Author Message
 possible bug?!

I was trying to make a property in MC++ and got the following error:
error C2327: 'bluh::bluh::Delimiter' : member from enclosing class is not a
type name, static, or enumerator (on line "__property Delimiter*
get_Delimiter ()")

I think the lexical parser is not working right - the problem seems to
happen when you have the property named the same as the object type returned
by the get_ property, here is the source:

//some namespace
public __gc class Delimiter : public ICloneable
{
  public:
  Delimiter() {}
  Delimiter(Delimiter *delim) {}
  Object* Clone() {return new Delimiter(this);}

Quote:
};

public __gc class StringTokeneizer
{
protected:
  Delimiter *delim;

public:
  __property void set_Delimiter (Delimiter *delim)  { delim = new
Delimiter(delim); }
  __property Delimiter* get_Delimiter ()  { return
(Delimiter*)(delim->Clone()); }

Quote:
};

Change the set_Delimiter get_Delimiter to set_Delimiter1 and get_Delimiter1
and the problems are gone. I am pretty sure I had this working in C#, whats
up?

Mark



Sat, 12 Jun 2004 14:21:47 GMT  
 possible bug?!
Mark,

Quote:
> I was trying to make a property in MC++ and got the following error:
> error C2327: 'bluh::bluh::Delimiter' : member from enclosing class is not
a
> type name, static, or enumerator (on line "__property Delimiter*
> get_Delimiter ()")

> I think the lexical parser is not working right - the problem seems to
> happen when you have the property named the same as the object type
returned
> by the get_ property, here is the source:

It happens because, by the time the compiler gets there, it has already
weak-injected the pseudo variable that represents the property, which
confuses it.

A simple workaround is to explicitly qualify the names of the type, with the
namespace name. For example, if your code was inside the global namespace,
this would work:
public __gc class StringTokeneizer
{
protected:
  Delimiter *delim;

public:
  __property void set_Delimiter (Delimiter *delim)  { delim = new
::Delimiter(delim); }
  __property ::Delimiter* get_Delimiter ()  { return
static_cast<::Delimiter*>(delim->Clone()); }

Quote:
};

HTH,
--
Tomas Restrepo



Sat, 12 Jun 2004 22:58:17 GMT  
 possible bug?!
I'll try that, thanks. But it seems that this should work like it does in
C#...

Mark

<snipped>



Mon, 14 Jun 2004 07:00:14 GMT  
 possible bug?!
Different languages, different rules, different implementations.

The argument "it seems like it should work in X like it works in Y" never
carries much weight. Were it true, X *would* be Y.

--
MichKa

Michael Kaplan
(principal developer of the MSLU)
Trigeminal Software, Inc.  -- http://www.trigeminal.com/
the book -- http://www.i18nWithVB.com/


Quote:
> I'll try that, thanks. But it seems that this should work like it does in
> C#...

> Mark

> <snipped>



Mon, 14 Jun 2004 07:32:58 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Possible bug with Bitmap(string) constructor?

2. ThreadPool possible bug? [NUnit test included]

3. Possible bug in development environment?

4. two possible bugs in 7.1

5. UNICODE file handling - possible bug

6. (CP) Possible bug in math.h in VS.NET 2003 FB

7. Possible bug when (not) implementing abstract methods

8. Possible bug with error C2664

9. Possible bug in Button

10. Possible Bug in Debugger????

11. Possible [BUG]: System.TypeLoadException when using std::hash_map in MC++

12. Possible bug placing breakpoints in C++ code

 

 
Powered by phpBB® Forum Software