Skip to content

Problems with type qualifiers around typedefs #373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
john-h-kastner opened this issue Jan 12, 2021 · 2 comments
Closed

Problems with type qualifiers around typedefs #373

john-h-kastner opened this issue Jan 12, 2021 · 2 comments

Comments

@john-h-kastner
Copy link
Collaborator

In some cases type qualifiers are dropped:

typedef int foo;
const foo *a;

converts to

typedef int foo;
_Ptr<foo> a = ((void *)0);

Other times the type qualifier can be moved inside the typdef:

typedef int *bar;
const bar b;

converts to

typedef const _Ptr<int> bar;
bar b = ((void *)0);
@john-h-kastner
Copy link
Collaborator Author

After looking at this briefly, the first problem should be fixable by adding the type qualifier to the string constructed by mkString for the base type in the typedef case.

} else if (typedeflevelinfo.hasTypedef) {
auto name = typedeflevelinfo.typedefName;
Ss << name;

The second problem is more difficult. I think that typedefs don't get their own constraint variable right now, so a typdef declaration is rewritten based on one of the variable declaration that uses it. This is fine for the purpose of checked/pointer type solution, but it means that the typdef ends up using the type qualifiers of one of associated variables.

aaronjeline pushed a commit that referenced this issue Jan 12, 2021
aaronjeline pushed a commit that referenced this issue Jan 28, 2021
@mwhicks1
Copy link
Member

mwhicks1 commented Feb 5, 2021

Another interesting example:

typedef int * * const a;
a b;
const a c;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants