mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
C++: Add a test for constexpr functions
This commit is contained in:
24
cpp/ql/test/library-tests/functions/constexpr/constexpr.cpp
Normal file
24
cpp/ql/test/library-tests/functions/constexpr/constexpr.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
constexpr int fun_constexpr();
|
||||
int fun_not_constexpr();
|
||||
|
||||
constexpr int overloaded_fun(int i) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
int overloaded_fun(float f) {
|
||||
return 6;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr int template_fun(T t) {
|
||||
return overloaded_fun(t);
|
||||
}
|
||||
|
||||
void caller(void) {
|
||||
int i;
|
||||
float f;
|
||||
template_fun(i);
|
||||
template_fun(f);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user