1 // { dg-do compile }
2 
3 // Copyright (C) 2001 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 31 Dec 2001 <nathan@codesourcery.com>
5 
6 // PR 5132. ICE on struct constructors in templates.
7 
8 // snippets from bits/huge_val.h
9 
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)
14 
foo(const int &)15 void foo( const int&) {
16   HUGE_VAL; // no problem here
17 }
18 
19 template <class F>
Tfoo(const F &)20 void Tfoo( const F&) {
21   HUGE_VAL; // g++ fails here
22 }
23 
24 template <typename T> struct M { T m; };
25 
Foo()26 void Foo ()
27 {
28   Tfoo (1.2f);
29   (__extension__ ((M<int>) {m:3}));
30   (__extension__ ((M<short> []) {{m:3}}));
31 }
32