diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
commit | bca07a4524feb4edec581062d631a13116320a24 (patch) | |
tree | a9243275843fbeaa590afc07ee888e006b8d54ea /test/SemaCXX/return-stack-addr.cpp | |
parent | 998bc5802ecdd65ce3b270f6c69a8ae8557f0a10 (diff) |
Notes
Diffstat (limited to 'test/SemaCXX/return-stack-addr.cpp')
-rw-r--r-- | test/SemaCXX/return-stack-addr.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/SemaCXX/return-stack-addr.cpp b/test/SemaCXX/return-stack-addr.cpp index 7d4cb964029bc..fbbaf836f1abf 100644 --- a/test/SemaCXX/return-stack-addr.cpp +++ b/test/SemaCXX/return-stack-addr.cpp @@ -119,5 +119,23 @@ struct PR7999_X {}; PR7999_X& PR7999_f(PR7999<PR7999_X> s) { return s.value; } // no-warning void test_PR7999(PR7999_X& x) { (void)PR7999_f(x); } // no-warning +// PR 8774: Don't try to evaluate parameters with default arguments like +// variables with an initializer, especially in templates where the default +// argument may not be an expression (yet). +namespace PR8774 { + template <typename U> struct B { }; + template <typename V> V f(typename B<V>::type const &v = B<V>::value()) { + return v; + } + template <> struct B<const char *> { + typedef const char *type; + static const char *value(); + }; + void g() { + const char *t; + f<const char*>(t); + } +} + // TODO: test case for dynamic_cast. clang does not yet have // support for C++ classes to write such a test case. |