Move all C++ tests to cpp.
This commit is contained in:
52
cpp/test_const_arg.cpp
Normal file
52
cpp/test_const_arg.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
void f ( int& i )
|
||||
{
|
||||
std::cout << "int" << std::endl;
|
||||
}
|
||||
|
||||
void f ( const int& i )
|
||||
{
|
||||
std::cout << "const int" << std::endl;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void f ( volatile int& i )
|
||||
{
|
||||
std::cout << "volatile int" << std::endl;
|
||||
}
|
||||
|
||||
void f ( const volatile int& i )
|
||||
{
|
||||
std::cout << "const volatile int" << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
int g ( )
|
||||
{
|
||||
int i = 2;
|
||||
return i;
|
||||
}
|
||||
|
||||
int main( void )
|
||||
{
|
||||
#if 0
|
||||
const volatile int cvi = 1;
|
||||
f( cvi );
|
||||
|
||||
volatile int vi = 1;
|
||||
f( vi );
|
||||
#endif
|
||||
|
||||
const int ci = 1;
|
||||
f( ci );
|
||||
|
||||
int i = 1;
|
||||
f( i );
|
||||
|
||||
f( g() );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user