[Issue 4986] New: IFTI fails on partial matching with value parameters
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Oct 4 00:43:13 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4986
Summary: IFTI fails on partial matching with value parameters
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: simen.kjaras at gmail.com
--- Comment #0 from Simen Kjaeraas <simen.kjaras at gmail.com> 2010-10-04 00:42:50 PDT ---
The following code fails to deduce the value of m2 in bar:
struct Foo( int n, int m ) {
/// Bugged:
void bar( int m2 )( Foo!( m2, n ) arg ) {}
// Workaround:
void baz( int n2, int m2 )( Foo!( n2, m2 ) arg ) if ( n == n2 ) {}
}
void bug( )( ) {
Foo!(3,2) f;
Foo!(3,3) g;
f.baz( g ); // Works.
f.bar( g ); // Fails.
}
foo.d(14): Error: template foo.Foo!(3,2).Foo.bar(int m2) does not match any
func
tion template declaration
foo.d(14): Error: template foo.Foo!(3,2).Foo.bar(int m2) cannot deduce template
function from argument types !()(Foo!(3,3))
Note also that this works for type parameters:
struct Foo( T, U ) {
void bar( V )( Foo!( T, V ) arg ) {}
}
void bug( )( ) {
Foo!(int, float) f;
Foo!(int, string) g;
f.bar( g );
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list