FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.dg / template / ctor1.C
blob81caa1fb47e097b28dcfcd3917ed9dd3f41614c0
1 // { dg-do compile }
3 // Copyright (C) 2001 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 31 Dec 2001 <nathan@codesourcery.com>
6 // PR 5132. ICE on struct constructors in templates.
8 // snippets from bits/huge_val.h
10 #define __HUGE_VAL_bytes        { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }
11 #define __huge_val_t    union { unsigned char __c[8]; double __d; }
12 #define HUGE_VAL       (__extension__ \
13   ((__huge_val_t) { __c: __HUGE_VAL_bytes }).__d)
15 void foo( const int&) {
16   HUGE_VAL; // no problem here
19 template <class F>
20 void Tfoo( const F&) {
21   HUGE_VAL; // g++ fails here
24 template <typename T> struct M { T m; };
26 void Foo ()
28   Tfoo (1.2f);
29   (__extension__ ((M<int>) {m:3}));
30   (__extension__ ((M<short> []) {{m:3}}));