mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-25 12:41:01 +08:00
re PR c++/53788 (C++11 decltype sfinae static member function check (4.7.1))
PR c++/53788 * pt.c (build_non_dependent_expr): Don't wrap a dummy object. From-SVN: r189188
This commit is contained in:
parent
65f0c5b308
commit
e961d86e32
@ -1,5 +1,8 @@
|
||||
2012-07-02 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/53788
|
||||
* pt.c (build_non_dependent_expr): Don't wrap a dummy object.
|
||||
|
||||
PR c++/53816
|
||||
* class.c (resolves_to_fixed_type_p): Check uses_template_parms
|
||||
(current_function_decl) instead of processing_template_decl.
|
||||
|
@ -20215,6 +20215,10 @@ build_non_dependent_expr (tree expr)
|
||||
if (BRACE_ENCLOSED_INITIALIZER_P (expr))
|
||||
return expr;
|
||||
|
||||
/* Don't wrap a dummy object, we need to be able to test for it. */
|
||||
if (is_dummy_object (expr))
|
||||
return expr;
|
||||
|
||||
if (TREE_CODE (expr) == COND_EXPR)
|
||||
return build3 (COND_EXPR,
|
||||
TREE_TYPE (expr),
|
||||
|
@ -1,5 +1,9 @@
|
||||
2012-07-02 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/53788
|
||||
* g++.dg/cpp0x/decltype39.C: New.
|
||||
* g++.dg/diagnostic/method1.C: Adjust.
|
||||
|
||||
PR c++/53816
|
||||
* g++.dg/template/ref6.C: New.
|
||||
|
||||
|
19
gcc/testsuite/g++.dg/cpp0x/decltype39.C
Normal file
19
gcc/testsuite/g++.dg/cpp0x/decltype39.C
Normal file
@ -0,0 +1,19 @@
|
||||
// PR c++/53788
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
struct t { static const bool value = true; };
|
||||
struct f { static const bool value = false; };
|
||||
|
||||
template<typename T>
|
||||
struct has_static {
|
||||
template<typename X>
|
||||
static t check(X*, decltype(T::fun())* = 0); // { dg-error "without object" }
|
||||
static f check(...);
|
||||
|
||||
typedef decltype(check((T*)(0))) ret;
|
||||
static const bool value = ret::value;
|
||||
};
|
||||
|
||||
struct test { int fun() { return 0; } };
|
||||
|
||||
bool b = has_static<test>::value;
|
@ -10,7 +10,7 @@ template <class T>
|
||||
void
|
||||
bar ()
|
||||
{
|
||||
A::foo ().anything; // { dg-error "request for member" }
|
||||
A::foo ().anything; // { dg-error "without object" }
|
||||
}
|
||||
|
||||
void
|
||||
@ -18,5 +18,3 @@ baz ()
|
||||
{
|
||||
bar <int> ();
|
||||
}
|
||||
|
||||
// { dg-prune-output "without object" }
|
||||
|
Loading…
x
Reference in New Issue
Block a user