Jump to content
Sign in to follow this  
chovain

Pointer-to-pointer To Member Variable

Recommended Posts

Compiler: boostc++_pic18 [running from cmdline]

Version: 7.0.1 7.0.3

Target: PIC18F4550

OS: Win7-64

 

Bug description:

Applying the unary pointer operator (&) to a pointer-type member variable results in an expression of incorrect type. Taking the address of a char* results in another char*. Non-member variables do not have this problem.

 

Steps to reproduce:

 

The following code does not compile.

#include <system.h>

char *globalPointer;

class Foo
{
public:
char *instancePointer;

void bar();
};

void Foo::bar()
{
char *localPointer;

char **x;
x = &localPointer;
x = &globalPointer;
x = &instancePointer;
}

 

The compiler fails on the line "x = &instancePointer", with "error: can't convert 'unsigned char*' to 'unsigned char**'", suggesting it thinks "&instancePointer" is of type "char*".

 

Is the problem 100% reproduceable: It appears to be, although I've only noticed it the once (plus this cut-down example).

 

Expected behaviour: I expect it to compile :lol:

 

Is this likely to have been corrected between 7.0.1 and 7.0.3? I tried upgrading to 7.0.3. It behaves the same way.

 

(Incidentally, are there any release notes detailing what changes between versions?)

 

Edit: Tried upgrading to 7.0.3.

Edited by chovain

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×