From: Douglas Gregor Date: Fri, 13 Mar 2009 21:04:12 +0000 (+0000) Subject: Devious test-case involved overload resolution and ADL during template instantiation. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=940bd834cd5419f8a8b6ae3c871fb1f8275a06fc;p=clang Devious test-case involved overload resolution and ADL during template instantiation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66951 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/SemaTemplate/instantiate-expr-2.cpp b/test/SemaTemplate/instantiate-expr-2.cpp new file mode 100644 index 0000000000..81af5730de --- /dev/null +++ b/test/SemaTemplate/instantiate-expr-2.cpp @@ -0,0 +1,52 @@ +// RUN: clang -fsyntax-only %s +typedef char one_byte; +typedef char (&two_bytes)[2]; +typedef char (&four_bytes)[4]; +typedef char (&eight_bytes)[8]; + +template struct A { }; + +namespace N1 { + struct X { }; +} + +namespace N2 { + struct Y { }; + + two_bytes operator+(Y, Y); +} + +namespace N3 { + struct Z { }; + + eight_bytes operator+(Z, Z); +} + +namespace N4 { + one_byte operator+(N1::X, N2::Y); + + template + struct BinOpOverload { + typedef A type; + }; +} + +namespace N1 { + four_bytes operator+(X, X); +} + +namespace N3 { + eight_bytes operator+(Z, Z); // redeclaration +} + +void test_bin_op_overload(A<1> *a1, A<2> *a2, A<4> *a4, A<8> *a8) { + typedef N4::BinOpOverload::type XY; + XY *xy = a1; + typedef N4::BinOpOverload::type XX; + XX *xx = a4; + typedef N4::BinOpOverload::type YY; + YY *yy = a2; + typedef N4::BinOpOverload::type ZZ; + ZZ *zz = a8; +} +