11c468f90Schristos /* This testcase is part of GDB, the GNU debugger.
21c468f90Schristos 
3*1424dfb3Schristos    Copyright 2014-2020 Free Software Foundation, Inc.
41c468f90Schristos 
51c468f90Schristos    This program is free software; you can redistribute it and/or modify
61c468f90Schristos    it under the terms of the GNU General Public License as published by
71c468f90Schristos    the Free Software Foundation; either version 3 of the License, or
81c468f90Schristos    (at your option) any later version.
91c468f90Schristos 
101c468f90Schristos    This program is distributed in the hope that it will be useful,
111c468f90Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
121c468f90Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
131c468f90Schristos    GNU General Public License for more details.
141c468f90Schristos 
151c468f90Schristos    You should have received a copy of the GNU General Public License
161c468f90Schristos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
171c468f90Schristos 
181c468f90Schristos /* Sizeof tests for rvalue references, based on cpsizeof.cc.  */
191c468f90Schristos 
201c468f90Schristos #include <utility>
211c468f90Schristos 
221c468f90Schristos struct Class
231c468f90Schristos {
241c468f90Schristos   int a;
251c468f90Schristos   char b;
261c468f90Schristos   long c;
271c468f90Schristos 
ClassClass281c468f90Schristos   Class () : a (1), b ('2'), c (3) { }
291c468f90Schristos };
301c468f90Schristos 
311c468f90Schristos union Union
321c468f90Schristos {
331c468f90Schristos   Class *kp;
341c468f90Schristos   char a;
351c468f90Schristos   int b;
361c468f90Schristos   long c;
371c468f90Schristos };
381c468f90Schristos 
391c468f90Schristos enum Enum { A, B, C, D };
401c468f90Schristos 
411c468f90Schristos typedef unsigned char a4[4];
421c468f90Schristos typedef unsigned char a8[8];
431c468f90Schristos typedef unsigned char a12[12];
441c468f90Schristos typedef Class c4[4];
451c468f90Schristos typedef Union u8[8];
461c468f90Schristos typedef Enum e12[12];
471c468f90Schristos 
481c468f90Schristos #define T(N)					\
491c468f90Schristos   N N ## obj;					\
501c468f90Schristos   N&& N ## _rref = std::move (N ## obj);        \
511c468f90Schristos   N* N ## p = &(N ## obj);			\
521c468f90Schristos   N*&& N ## p_rref = std::move (N ## p);        \
531c468f90Schristos   int size_ ## N = sizeof (N ## _rref);		\
541c468f90Schristos   int size_ ## N ## p = sizeof (N ## p_rref);	\
551c468f90Schristos 
561c468f90Schristos int
main()571c468f90Schristos main ()
581c468f90Schristos {
591c468f90Schristos   T (char);
601c468f90Schristos   T (int);
611c468f90Schristos   T (long);
621c468f90Schristos   T (float);
631c468f90Schristos   T (double);
641c468f90Schristos   T (a4);
651c468f90Schristos   T (a8);
661c468f90Schristos   T (a12);
671c468f90Schristos   T (Class);
681c468f90Schristos   T (Union);
691c468f90Schristos   T (Enum);
701c468f90Schristos   T (c4);
711c468f90Schristos   T (u8);
721c468f90Schristos   T (e12);
731c468f90Schristos 
741c468f90Schristos   return 0; /* break here */
751c468f90Schristos }
76