Skip to content
GitLab
Projects Groups Topics 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
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 168
    • Issues 168
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
    • Model experiments
  • 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
  • #250

cast error with reference fields

ID0002396: This issue was created automatically from Mantis Issue 2396. Further discussion may take place here.


Id Project Category View Due Date Updated
ID0002396 Frama-C Plug-in > clang public 2018-08-24 2018-08-24
Reporter abhishek.anand.iitg@gmail.com Assigned To virgile Resolution open
Priority normal Severity minor Reproducibility always
Platform - OS manjaro OS Version 8/23/3018
Product Version Frama-C 17-Chlorine Target Version - Fixed in Version -

Description :

class B {
};

template <typename T>
class A {
public:
  T &x;
  A(T &y): x(y) {}
};

int main()
{
    B b;
    B & y=b;
    A<B> a(y);
}

I get the following error:

root@27db7a69b96a:/hostshare# frama-c -print refFieldBug.cpp                
[kernel] Parsing refFieldBug.cpp (external front-end)
Now output intermediate result
[kernel] refFieldBug.cpp:8: Failure: castTo struct _Z1B -> struct _Z1B *
[kernel] User Error: stopping on file "refFieldBug.cpp" that has errors.
[kernel] Frama-C aborted: invalid user inp

I don't see what could be the problem because the following succeeds:

class A {
public:
  T &x;
  A(T &y): x(y) {}
};

int main()
{
    int x=0;
    int & y=x;
    A<int> a(y);
}
Edited Mar 30, 2021 by Virgile Prevosto
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking