-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #554 from guwirth/enhancement/cpp11_examples
narrow down C++11 issues:
- Loading branch information
Showing
4 changed files
with
53 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 6 additions & 7 deletions
13
cxx-squid/src/test/resources/parser/own/C++11/parameter-pack-sizeof.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 30 additions & 30 deletions
60
cxx-squid/src/test/resources/parser/own/C++11/user-defined-literals.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
#include <iostream> | ||
|
||
//ToDo - make this work | ||
// used as conversion | ||
//constexpr long double operator"" _deg(long double deg) | ||
//{ | ||
// return deg*3.141592 / 180; | ||
//} | ||
// | ||
//// used with custom type | ||
//struct mytype | ||
//{ | ||
// mytype(unsigned long long m) :m(m) {} | ||
// unsigned long long m; | ||
//}; | ||
//mytype operator"" _mytype(unsigned long long n) | ||
//{ | ||
// return mytype(n); | ||
//} | ||
// | ||
//// used for side-effects | ||
//void operator"" _print(const char* str) | ||
//{ | ||
// std::cout << str; | ||
//} | ||
// | ||
//int main() { | ||
// double x = 90.0_deg; | ||
// std::cout << std::fixed << x << '\n'; | ||
// mytype y = 123_mytype; | ||
// std::cout << y.m << '\n'; | ||
// 0x123ABC_print; | ||
//} | ||
constexpr long double operator"" _deg(long double deg) | ||
{ | ||
return deg*3.141592 / 180; | ||
} | ||
|
||
// used with custom type | ||
struct mytype | ||
{ | ||
mytype(unsigned long long m) :m(m) {} | ||
unsigned long long m; | ||
}; | ||
mytype operator"" _mytype(unsigned long long n) | ||
{ | ||
return mytype(n); | ||
} | ||
|
||
// used for side-effects | ||
void operator"" _print(const char* str) | ||
{ | ||
std::cout << str; | ||
} | ||
|
||
//ToDo - make this work | ||
int main() { | ||
//double x = 90.0_deg; | ||
std::cout << std::fixed << x << '\n'; | ||
//mytype y = 123_mytype; | ||
std::cout << y.m << '\n'; | ||
//0x123ABC_print; | ||
} |