https://bugs.kde.org/show_bug.cgi?id=409596

            Bug ID: 409596
           Summary: Adding a lambda as a template argument in a specific
                    project (of mine) causes a crash when trying to parse
                    a file.
           Product: kdevelop
           Version: git master
          Platform: Manjaro
                OS: Linux
            Status: REPORTED
          Severity: crash
          Priority: NOR
         Component: Code completion
          Assignee: kdevelop-bugs-n...@kde.org
          Reporter: mattibr...@protonmail.com
  Target Milestone: ---

Created attachment 121371
  --> https://bugs.kde.org/attachment.cgi?id=121371&action=edit
File attempting to produce a reduced form of the bug (failed)

SUMMARY
Adding a lambda as a template argument in a specific project (of mine) causes a
crash when trying to parse a file.

STEPS TO REPRODUCE
1. Download the project via `git clone
https://gitlab.com/TheEdenCrazy/correlative-neural-network.git`, `git checkout
e8861a831819b858f9792570b8aebe9b2641b06b`
2. Open in kdevelop, making sure to set the C++ parser to C++17 (I don't know
if the bug is c++-version-dependent but this should replicate it).
3. Add `_impl_add_t<&neuron_index::idx, [](){}> v;` to the file at
"correlative-neural-network/library/include/cnn/storeprotodef/field_encode_gen.hpp",
as a member of the template struct `_impl_FieldEncodingGenerator`, after the
templates. 

OBSERVED RESULT
KDevelop crashes with a segfault after producing the following on the console:
 QProcess: Destroyed while process ("clang") is still running.
 kdevplatform.shell: process finished with error: QProcess::Crashed
 QProcess: Destroyed while process ("clang") is still running.
 kdevplatform.shell: process finished with error: QProcess::Crashed
 kdevelop.plugins.clang: Unhandled type: Dependent <dependent type>
 kdevelop.plugins.clang: Unhandled type: Dependent <dependent type>
 kdevelop.plugins.clang: Unhandled type: Dependent <dependent type>
 kdevelop.plugins.clang: Unhandled type: Dependent <dependent type>
 kdevelop.plugins.clang: Unhandled type: Dependent <dependent type>
 kdevelop.plugins.clang: Unhandled type: Dependent <dependent type>

EXPECTED RESULT
KDevelop does not crash, and (depending on the C++ version) there is either a
syntax error or no syntax error (C++20 allows lambdas as function template
arguments).


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Manjaro (latest update)
(available in About System)
KDE Plasma Version: [using xfce4-gtk3]
KDE Frameworks Version: KDevelop 5.3.2 and KDevelop as built from master.
Qt Version: 5.12.4

ADDITIONAL INFORMATION
I downloaded the Kdevelop project and built it and examined it in a debugger.
As far as I can tell, the issue is related to the parser not recognising the
type as one of those processed in kdevelop/plugins/clang, builder.cpp,
Visitor::makeType.

I have attempted to replicate the bug by simply copy-pasting the core type
structure (i.e. type-template in template in 2 namespaces), but it does not
work. However, I cannot replicate it and it produces the expected behaviour.
See the file I used for testing attached.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to