Weird behaviour with Structs
See original GitHub issueI feel the following is an issue because the full code compiles, which indicates it is a valid construction. I don’t know much about structs in C++ though.
Anyway, the following is handled strangely (can see easier in Atom).
struct Scanner {
vector<CategoryDescription> category_descriptions = {
{FOO, FOO, FOO},
{FOO, FOO, FOO}
};
map<string, TokenType> tokens = {
{"(", BEGIN_INLINE_MATH},
{")", END_INLINE_MATH},
};
map<char, Category> catcodes = {
{'\\', ESCAPE_CATEGORY},
{'{', BEGIN_CATEGORY}
};
};
The first item is scoped differently to the others, and reordering them or adding fields above does not affect this (whatever the first is is still scoped differently).
It also folds incorrectly; folding line 1 folds up until the semicolon of the vector, when it should be folding the entire struct.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
C structs strange behaviour - Stack Overflow
The strange thing, is that the output of my program is dependent on the order in which I declare the components of this...
Read more >Strange behaviour with C30 and structs
[edit 13-2-2013] I've seen another strange behaviour in the declaration of my structs: struct MenuStruct Menu[AANTALMENUS] __attribute__((space( ...
Read more >Floating Point Numbers, Odd Behaviour and What You Should ...
Data Structures & Optimization. Floating Point Numbers, Odd Behaviour and What You Should Really Know (Data Structures & Algorithms).
Read more >Strange behaviour on sub-structures · Issue #130 · jinzhu/copier
My initial goal is to have a duplicate function. I'm using this function (with a recover) in my production environment with copier version...
Read more >Strange behaviour of json marshal of embedded struct
I really do not like this. I had an ugly bug in my code. What do you mean will be result of json...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed on Atom master! I hate to see Tree-sitter failing you while you’re working on a Tree-sitter parser (guessing from your example). Thanks for raising this!
~It’s not related to structs. The problem is that list initialization is not currently supported by the grammar.~ Nope, @Aerijo was correct all along.