Advertisement
zmatt

clpru-template-compound-literal

Jan 5th, 2024
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. // using: clpru (PRU C/C++ Compiler) v2.3.3
  2.  
  3.  
  4. //==== fails to compile:
  5.  
  6. template< int n >
  7. struct Foo {
  8. };
  9.  
  10. void foo( Foo<0> *p ) {
  11.         *p = (Foo<0>){};  // error: a compound literal of type "Foo<0>" is not allowed
  12. }
  13.  
  14.  
  15. //==== compiles ok:
  16.  
  17. template< int n >
  18. struct Foo {
  19. };
  20.  
  21. Foo<0> unused_foo;
  22.  
  23. void foo( Foo<0> *p ) {
  24.         *p = (Foo<0>){};
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement