www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [ ] isn't parsed correctly from a template char[] argument

reply Don Clugston <dac nospam.com.au> writes:
Possibly the same cause as the previous bug, because
it also goes away if you introduce parentheses.

Error:
  fish is used as a type

---------------
template whale(char walrus)
{
    const char whale = walrus;
}

template dolphin(char [] fish)
{
//const char dolphin = whale!((fish[4])); // OK
   const char dolphin = whale!(fish[4]); // fails
}

const char urchin = dolphin!("anenome");
Jan 12 2006
next sibling parent Chris Lajoie <ctlajoie___remove___this___ ___gmail.com> writes:
Don Clugston wrote:
 Possibly the same cause as the previous bug, because
 it also goes away if you introduce parentheses.
 
 Error:
  fish is used as a type
 
 ---------------
 template whale(char walrus)
 {
    const char whale = walrus;
 }
 
 template dolphin(char [] fish)
 {
 //const char dolphin = whale!((fish[4])); // OK
   const char dolphin = whale!(fish[4]); // fails
 }
 
 const char urchin = dolphin!("anenome");
I've run into this one too, although I didn't think to use an extra set of parens. Would be nice to see this fixed.
Jan 12 2006
prev sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Don Clugston schrieb am 2006-01-12:
 Possibly the same cause as the previous bug, because
 it also goes away if you introduce parentheses.

 Error:
   fish is used as a type

 ---------------
 template whale(char walrus)
 {
     const char whale = walrus;
 }

 template dolphin(char [] fish)
 {
 //const char dolphin = whale!((fish[4])); // OK
    const char dolphin = whale!(fish[4]); // fails
 }

 const char urchin = dolphin!("anenome");
Added to DStress as http://dstress.kuehne.cn/run/t/template_23_A.d http://dstress.kuehne.cn/run/t/template_23_B.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDyjV13w+/yD4P9tIRAuGfAJ4q0idAtFSS/XiwbguQgFi4hVDNgACdFLXG RmcSwlIWi+JGHy44IYGTsnI= =Wf4x -----END PGP SIGNATURE-----
Jan 15 2006