[frama-clang] Cannot parse built-in function __underlying_type()
Steps to reproduce the issue
Please find attached two example sources that demonstrate the issue: fails.cpp works.cpp
> cat fails.cpp
enum class SelectedNumbers : int { One = 1 };
int main() {
return static_cast<__underlying_type(SelectedNumbers)>(SelectedNumbers::One);
}
> clang++-11 -E -o fails.ii fails.cpp
> frama-c -deps 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:4:10: Unsupported Type (unknown kind (48)):__underlying_type(enum SelectedNumbers)
Aborting
[kernel] User Error: Failed to parse C++ file. See Clang messages for more information
[kernel] User Error: stopping on file "fails1.ii" that has errors.
[kernel] Frama-C aborted: invalid user input.
Minimal working diff
It works if we avoid the __underlying_type()
built-in function and instead specify it manually:
diff -u fails.cpp works.cpp
--- fails.cpp 2021-05-26 10:25:30.839759691 +0000
+++ works.cpp 2021-05-26 10:40:31.251352326 +0000
@@ -1,5 +1,5 @@
enum class SelectedNumbers : int { One = 1 };
int main() {
- return static_cast<__underlying_type(SelectedNumbers)>(SelectedNumbers::One);
+ return static_cast<int>(SelectedNumbers::One);
}
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