-
-
Notifications
You must be signed in to change notification settings - Fork 262
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Hey Andreas, I am sorry that I report so many issues recently, but cppinsights is just a great tool for learning C++ and it seems I occasionally tend to dig into the slightly more odd edge cases of the language 😸
Here is the source code:
struct A {
void f() {}
} a_var_1;
struct B {
} b_var_1, b_var_2, b_var_3;
struct {
} anonym_var_1, anonym_var_2, anonym_var_3;
struct {
} anonym_var_assign = {};
struct {
} anonym_var_array[3];
struct {
} anonym_var_dummy, *anonym_var_ptr;And this is what cppinsights (version 26c63ad) produces:
struct A a_var_1;
struct B b_var_3;
struct __anon_8_1
{
// inline constexpr __anon_8_1() noexcept = default;
};
__anon_8_1 anonym_var_1;
, anonym_var_2__anon_8_1 anonym_var_2;
, anonym_var_3;__anon_8_1 anonym_var_3;
struct __anon_11_1
{
};
= {};__anon_11_1 anonym_var_assign = {};
__anon_14_1 anonym_var_array[3];
__anon_17_1 * anonym_var_ptr;
I think there are several issues, but I assume they are related. So I hope it's fine that I create just one issue.
- 1. Creating a type and variable via
struct A{} a_var_1;producesstruct A a_var_1;. But instead it should show the whole type definition and a variable definition afterwards:
struct A {
//...
};
A a_var_1;- 2. Creating a type and multiple variables via
struct B {} b_var_1, b_var_2, b_var_3;producesstruct B b_var_3;(similar like in bullet point 1.). The additional issue is, that cppinsights completely swallows the definitions ofb_var_1andb_var_2. - 3. Creating an anonymous type and multiple variables via
struct {} anonym_var_1, anonym_var_2, anonym_var_3;does not swallow the first and second variables (other than in bullet point 2.), but only the definition ofanonym_var_1looks reasonable. The definitions ofanonym_var_2andanonym_var_3look wrong. - 4. Creating an anonymous type and one variable which gets initialized like in
struct {} anonym_var_assign = {};looks wrong in a sense that the initialization part (= {};) appears both before and after the variableanonym_var_assign. - 5. Creating an anonymous type and one or multiple variables with additional declarators (like array (
[3]) or pointer (*)) leads to the effect that both the anonymous struct definition does not get generated by cppinsights and that previous variable definitions (anonym_var_dummy) get swallowed.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working