blob: 5f6fc13d3d85a7c3a9fba057904ca066010d43a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
using System;
using System.Reflection;
[AttributeUsage(System.AttributeTargets.All)]
class A : Attribute
{
public double D;
public A (double d)
{
this.D = d;
}
}
class C
{
[A (0.7f * 100.0f)]
static int Main ()
{
if ((int) (0.7f * 100.0f) != 69)
return 1;
if ((double) (0.7f * 100.0f) != 69.9999988079071)
return 2;
if (!Foo (0.7f * 100.0f))
return 3;
A attr = (A)MethodBase.GetCurrentMethod ().GetCustomAttributes (false) [0];
if (attr.D != 69.9999988079071)
return 4;
Console.WriteLine ("ok");
return 0;
}
static bool Foo (double d)
{
return d == 69.9999988079071;
}
}
|