Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • F frama-c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 201
    • Issues 201
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • pub
  • frama-c
  • Issues
  • #2562
Closed
Open
Created Jun 08, 2021 by Stefan Gränitz@weliveindetail

[frama-clang] Cannot parse C++14 variable template

Steps to reproduce the issue

Please find attached two example sources that demonstrate the issue: fails.cpp works.cpp

> cat fails.cpp
template <class _Tp>
struct in_place_type_t {};

template <class _Tp>
in_place_type_t<_Tp> in_place_type{};

int main() {
  return 0;
}

> clang++-11 -E -o fails.ii fails.cpp
> frama-c -deps -cpp-extra-args=-std=c++14 fails.ii

Expected output

[kernel] Parsing fails.ii (external front-end)
Now output intermediate result
<...>
[from] Computing for function main
[from] Done for function main
[from] ====== DEPENDENCIES COMPUTED ======
  These dependencies hold at termination for the executions that terminate:
[from] Function main:
  \result FROM \nothing
[from] ====== END OF DEPENDENCIES ======

Actual output

[kernel] Parsing fails.ii (external front-end)
fails.cpp:5:22: Unsupported Type (uninstantiated template specialization):in_place_type_t<_Tp>
Aborting
[kernel] User Error: Failed to parse C++ file. See Clang messages for more information
[kernel] User Error: stopping on file "fails.ii" that has errors.
[kernel] Frama-C aborted: invalid user input.

Minimal working diff

It works if we avoid the unused in_place_type variable:

> diff -u fails.cpp works.cpp
--- fails.cpp   2021-06-08 22:57:23.374859568 +0000
+++ works.cpp   2021-06-08 23:04:33.305251313 +0000
@@ -1,8 +1,8 @@
 template <class _Tp>
 struct in_place_type_t {};
 
-template <class _Tp>
-in_place_type_t<_Tp> in_place_type{};
+//template <class _Tp>
+//in_place_type_t<_Tp> in_place_type{};
 
 int main() {
   return 0;

Contextual information

  • Frama-C: framac/frama-c:22.0 Docker Image ID e45780e160f1
  • Plug-in used: frama-clang-0.0.10 built from official source drop
  • Compiler: Debian clang version 11.1.0
  • Target: x86_64-pc-linux-gnu

Additional information

Variable templates are a C++14 language feature: https://isocpp.org/wiki/faq/cpp14-language#variable-templates

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking