-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Multiline templates not supported in sketch #4067
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
Comments
Ah thanks, that works! But the following does not:
|
Hm, that's weird. The preprocessed source file looks like this:
It seems the prototype is generated correctly, but the
@ffissore, I guess ctags doesn't completely understand templates after all, then? |
ctags output looks like this:
and for the working version with the template on a single line:
The gist of the ctags output looks identical, so I guess that for template functions, the prototype is built from the code line, instead of the function signature like normally? @ffissore, if this is so, perhaps we should drop that and just not generate prototypes for template functions? |
I'm not sure its a valid solution having simple functions generated, and basically everything else not. Maybe its time to stop hiding the basics of C++ and not generate any prototypes at all. It'll break old code, however the new arduino-builder has already broken previously working prototypes. I have a good list here: arduino/arduino-builder#30 I do not think it's going to be much of a problem, as the forum is already & still going to be bombarded with questions asking why some functions do not work. |
No. Massively breaking compatibility is not an option! |
Well as it stands, that is what is happening. This really needs to be sorted out, I just do not think disabling prototype generation for a majority of function signatures is an option either. If were going to tell people to generate their own for templates, bound return types, functions with optional parameters, (list goes on)... then we might as well disable it all (KISS, we don't need two rules for the same thing)! I know... just pointing out the obvious. 😄 |
@matthijskooijman as you found out, ctags output includes one code line, not "function". I will not disable template generation as it works well when functions are written all on one line. If "one line" is not an option, writing the prototype yourself is the workaround. This was one of the main goal of arduino-builder: do whatever you can to make things just work and provide options when they don't work. Previous prototype generation failed miserably, leaving users the only option to stop using the IDE: templates are an example, see #472 As for arduino/arduino-builder#30, some work is already available (see "functionpointer" branch): I just don't yet feel confident enough with it. |
This issue was moved to arduino/arduino-builder#43 |
The following sketch fails to compile:
With
error: 'T' does not name a type
This is with 1.6.5 on a mac
The text was updated successfully, but these errors were encountered: