fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. /* Actions definitions */
  6. template<typename Interface>
  7. struct A1 {
  8. void print() {
  9. cout << "A1 - ";
  10. Interface i;
  11. i.print();
  12. }
  13. };
  14.  
  15. template<typename Interface>
  16. struct A2 {
  17. void print() {
  18. cout << "A2 - ";
  19. Interface i;
  20. i.print();
  21. }
  22. };
  23.  
  24. /* Interfaces definitions */
  25. struct I1 {
  26. void print() {
  27. cout << "I1\n";
  28. }
  29. };
  30. struct I2 {
  31. void print() {
  32. cout << "I2\n";
  33. }
  34. };
  35.  
  36. /* Loop start (no loop now) */
  37. template<
  38. class Interface,
  39. template<typename I> class Action1,
  40. template<typename I> class ... Actions
  41. >
  42. void g() {
  43. cout << "First Action<Interface>\n";
  44. Action1<Interface> action;
  45. action.print();
  46. }
  47.  
  48. /* Starting function */
  49. template<class Interface, template<typename I> class ... Actions>
  50. void f()
  51. {
  52. g<Interface, Actions...>();
  53. }
  54.  
  55. /* Main */
  56. int main()
  57. {
  58. f<I1, A1, A2>();
  59. return 0;
  60. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'void f() [with Interface = I1, Actions = A1, A2]':
prog.cpp:58:16:   instantiated from here
prog.cpp:49:58: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
stdout
Standard output is empty