diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-05-11 08:41:30 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-05-11 08:41:30 +0000 |
commit | 0e4de76610edac3bc1541e5130a490925d6a9cf4 (patch) | |
tree | 9562edeabe2a6592dcf8ba0290763c2bb1bd7993 /clang/test/SemaTemplate/instantiate-member-pointers.cpp | |
parent | 6bd2d6c4becd02eb809b32c7494ad17f844bb5d6 (diff) | |
download | bcm5719-llvm-0e4de76610edac3bc1541e5130a490925d6a9cf4.tar.gz bcm5719-llvm-0e4de76610edac3bc1541e5130a490925d6a9cf4.zip |
A DeclRefExpr that refers to a member function or a static data member
of the current instantiation is value-dependent. The C++ standard
fails to enumerate this case and, therefore, we missed it. Chandler
did all of the hard work of reducing the last remaining
Boost.PtrContainer failure (which had to do with static initialization
in the Serialization library) down to this simple little test.
While I'm at it, clean up the dependence rules for template arguments
that are declarations, and implement the dependence rules for template
argument packs.
llvm-svn: 103464
Diffstat (limited to 'clang/test/SemaTemplate/instantiate-member-pointers.cpp')
-rw-r--r-- | clang/test/SemaTemplate/instantiate-member-pointers.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/instantiate-member-pointers.cpp b/clang/test/SemaTemplate/instantiate-member-pointers.cpp index 2308ac541b2..dca0f621705 100644 --- a/clang/test/SemaTemplate/instantiate-member-pointers.cpp +++ b/clang/test/SemaTemplate/instantiate-member-pointers.cpp @@ -53,3 +53,15 @@ void accept_X4(X4<Member>); void test_accept_X4(X4<&Y::x> x4) { accept_X4(x4); } + +namespace ValueDepMemberPointer { + template <void (*)()> struct instantiate_function {}; + template <typename T> struct S { + static void instantiate(); + typedef instantiate_function<&S::instantiate> x; // expected-note{{instantiation}} + }; + template <typename T> void S<T>::instantiate() { + int a[(int)sizeof(T)-42]; // expected-error{{array size is negative}} + } + S<int> s; +} |