Yes, someone actually posted this. --Sausage Oh fuck I broke the formatting :( Fixed it manually as best I can - worth it :D
Original subject: making a stat changer for eo
Jason pointed out that yesterday's name-lookup checkin broke the
following code:
int main() { int A = 42; struct A { enum { a }; }; A = A::a; return A; }
This is the infamous `struct stat' hack whereby there may be two
bindings for a name in a single scope if one of them is a class-name
or enum-name. We used to handle this, albeit in a rather hokey way.
This patch fixes this test-case, in a much less hokey way, as well as
the related case:
struct S { int A; struct A { enum { a = 0 }; }; void f(); }; void S::f() { A = A::a; }
which never worked at all. Along the way, we fixed:
template<class T> struct A { void X() throw(T); }; template<class T> inline void A<T>::X() throw(T) { }
which used to provoke a spurious error message. Also:
struct T { int operator()(int) { } }; int main() { T()(); }
which used to crash, as did:
namespace N { template <class T> struct S; }; void f() { N::S(); // ERROR - invalid use of template }
and:
namespace N { template <class T> struct S; }; void f() { N::S(); }
We used to fail to unify in:
template<int N, class C> class Bar {}; template<class C> class Huh {}; template<int N> void foo(const Bar<N,Huh<float[1]> > &x) {} int main() { foo(Bar<3,Huh<float[1]> >()); }
Finally, we mishandled overload resolution in a variety of different
contexts:
// Build don't link: template <int i> class a { public : int k; template <int j> int f() const { return this->f<j-1>(); } int g() const { return f<i>(); }; }; template <> template <> int a<2>::f<0>() const { return 0; } int main() { a<2> x; return x.g(); }
and:
template <class T> int f(int (*fn)(T)) { return (*fn)(3); } struct S { static int g(int) { return 1; } static void g(); int h(); }; int S::h() { return f(&g); } int main() { S s; if (s.h () != 1) return 1; }
and:
template<class T,class T1> int connect_to_method(T* receiver, int (T1::*method)()) { return (receiver->*method)(); } class Gtk_Container { public: int remove_callback() { return 1; } void remove_callback(int); int f(); }; int Gtk_Container::f() { return connect_to_method(this, &Gtk_Container::remove_callback); } int main() { Gtk_Container gc; if (gc.f () != 1) return 1; }
-- Mark Mitchell
mark@markmitchell.com
Mark Mitchell Consulting
http://www.markmitchell.com
1998-12-14
Mark Mitchell <mark@markmitchell.com>
* class.c (pushclass): Tweak handling of class-level bindings.
(resolve_address_of_overloaded_function): Update pointer-to-member
handling.
(instantiate_type): Likewise.
* cvt.c (cp_convert_to_pointer): Likewise.
* decl.c (pop_binding): Take the DECL to pop, not just the name.
Deal with `struct stat' hack.
(binding_level): Add to documentation.
(push_binding): Clear BINDING_TYPE.
(add_binding): New function.
(push_local_binding): Use it.
(push_class_binding): Likewise.
(poplevel): Adjust calls to pop_binding.
(poplevel_class): Likewise.
(pushdecl): Adjust handling of TYPE_DECLs; add bindings for hidden
declarations to current binding level.
(push_class_level_binding): Likewise.
(push_overloaded_decl): Adjust handling of OVERLOADs in local
bindings.
(lookup_namespace_name): Don't crash when confronted with a
TEMPLATE_DECL.
(lookup_name_real): Do `struct stat' hack in local binding
contexts.
(build_ptrmemfunc_type): Adjust documentation.
(grokdeclarator): Don't avoid building real array types when
processing templates unless really necessary.
(finish_method): Adjust calls to pop_binding.
* decl2.c (reparse_absdcl_as_expr): Recursively call ourselves,
not reparse_decl_as_expr.
(build_expr_from_tree): Deal with a template-id as the function to
call in a METHOD_CALL_EXPR.
* pt.c (convert_nontype_argument): Tweak pointer-to-member handling.
(maybe_adjust_types_For_deduction): Don't do peculiar things with
METHOD_TYPEs here.
(resolve_overloaded_unification): Handle COMPONENT_REFs. Build
pointer-to-member types where necessary.
* tree.c (build_cplus_array_type_1): Don't avoid building real
array types when processing templates unless really necessary.
(build_exception_variant): Compare the exception lists correctly.
begin 600 diffs.gzM'XL("..>=38``V1I9F9S`.P\:W/;.)*?G5\!S]6.)8>>Z&59BB]3Y8>2^,ZQM7;*=N?W$T!)D<
4V36I+R8V?GOU\_`!"D2%E.,IG,W*DJCD0"C49WHU]HX"@<MRX?78C1[-0J\)/EI].+-EW]>#`_.Q<0/Y&OQ2EZ/DE
<C+TZC\-7H+L&G"3^\M'HU>9>,Z=R]BF<:^O//#:Q'#?XD?A:+Y4[/5?#'V)Q.Q-1);,[$5TR.AT=W<MW-3?UYK]?N]5L
_6JV1;-SNO.]NOMYAH#V-K:6FS5$:T6MFKT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R'C.,H=F^]^,8-H[%4JA7<EWD<%E^
2ZJ-?M2D7A'!`0JU>+<(`#$%LHG*@?O3T]&PSW3@ZI`1(-VDS"[/7!Z<GYQ=[)A0&0M(+M',S7&.B-N\4H-4,K8I8I`=U
Q4`C3_7S6`BN6ONQL;#?B6*(LB5QK:!/]FMC$?V3=$<&I(HT;KO['2`<?VV<42^/N.^+FN4"'\8?'A[>7*`<FPH7:`L+)
-?M0`'-DU3,$TGKI*`&<NL?#-_P_3FIG\PO$DG$JVR!\#=A=)_P.^P&^FKJW4E<M?:!\+`!>`*MQ_)@W8$I;@>FB10:
K]`B^03L'S9B?6/W_@?A[8N_P<.@._N=LM*-!BPP.<_<71Z0GY4EI;4:?%55(D&JS_O)`^*64%F(O2]E*LD>OS$G\"
Y=^3M%@<');Q.1#2/1>*#OI"[AE#RP1NEH,_OD8+P,)1RS-,@$$N7^A."?92%:7?IM'Q&DX:B5(5JG6XS0.EW!B%)X
AM],V-7HBV;W=:OQNM%:HZX4F^6:F,BLV5A0MXJ.9J]PC-XU<)8#:NY8/LYA]Z_ZVTVRTC>[6A"4?=*M@.ZR%I_T'=FK
8FZD4M-25G6\:$O??`I$KAA=YH&D>AG\!B5\X<4BH1DSBZ%;77KS?KM3HNUM&=N(O\M\:;`0`D?%HR;99%+-;:6E
B76V"ALL[JH)Q*=:-0H]ZM7)',3'.IFIYWSI]%%M493+\*`NNRMR@0$8/F3PJCBA.AA>0."9Q9-$$M-".6ID$ZA5GJ3BW
_\6^OEPM\'8P')P<#(R5P\^O)?-$O#Y`V`K!]O"(%+X]GFFO9YMORJQ=?Z/@L?JI]L8-M0X>#@]/AH18$[F/'C27=GFZ
7D1X$I-D""8%HR7:(REMOVED -- Exactly 11,316 random letters and symbols)````end
It's a process that i will get it right 1 of these days. And when i get it done i will have the most powerful eo charecter.
|