re PR c++/49181 ([C++0x] Error reporting routines re-entered)
PR c++/49181 * pt.c (get_mostly_instantiated_function_type): Use push_access_scope. From-SVN: r174352
This commit is contained in:
parent
4cc4f2f437
commit
0453694246
4 changed files with 120 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
|||
2011-05-27 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/49181
|
||||
* pt.c (get_mostly_instantiated_function_type): Use push_access_scope.
|
||||
|
||||
2011-05-27 Nathan Froyd <froydnj@codesourcery.com>
|
||||
|
||||
* cp-tree.h (building_stmt_tree): Delete.
|
||||
|
|
|
@ -18080,9 +18080,9 @@ get_mostly_instantiated_function_type (tree decl)
|
|||
TMPL_ARGS_DEPTH (targs),
|
||||
make_tree_vec (DECL_NTPARMS (tmpl)));
|
||||
|
||||
/* Disable access control as this function is used only during
|
||||
name-mangling. */
|
||||
push_deferring_access_checks (dk_no_check);
|
||||
/* Make sure that we can see identifiers, and compute access
|
||||
correctly. */
|
||||
push_access_scope (decl);
|
||||
|
||||
++processing_template_decl;
|
||||
/* Now, do the (partial) substitution to figure out the
|
||||
|
@ -18097,7 +18097,7 @@ get_mostly_instantiated_function_type (tree decl)
|
|||
TREE_VEC_LENGTH (partial_args)--;
|
||||
tparms = tsubst_template_parms (tparms, partial_args, tf_error);
|
||||
|
||||
pop_deferring_access_checks ();
|
||||
pop_access_scope (decl);
|
||||
}
|
||||
|
||||
return fn_type;
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2011-05-27 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* g++.dg/cpp0x/error5.C: New.
|
||||
|
||||
2011-05-27 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/49165
|
||||
|
|
107
gcc/testsuite/g++.dg/cpp0x/error5.C
Normal file
107
gcc/testsuite/g++.dg/cpp0x/error5.C
Normal file
|
@ -0,0 +1,107 @@
|
|||
// PR c++/49181
|
||||
// { dg-options -std=c++0x }
|
||||
|
||||
namespace std
|
||||
{
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
|
||||
template<typename _Tp, _Tp>
|
||||
struct integral_constant;
|
||||
|
||||
template<typename _Tp, _Tp __v>
|
||||
struct integral_constant
|
||||
{
|
||||
static constexpr _Tp value = __v;
|
||||
typedef _Tp value_type;
|
||||
typedef integral_constant<_Tp, __v> type;
|
||||
constexpr operator value_type() { return value; }
|
||||
};
|
||||
|
||||
typedef integral_constant<bool, true> true_type;
|
||||
|
||||
typedef integral_constant<bool, false> false_type;
|
||||
|
||||
template<typename _Tp, _Tp __v>
|
||||
constexpr _Tp integral_constant<_Tp, __v>::value;
|
||||
|
||||
template<bool, typename _Tp = void>
|
||||
struct enable_if
|
||||
{ };
|
||||
|
||||
template<typename _Tp>
|
||||
struct enable_if<true, _Tp>
|
||||
{ typedef _Tp type; };
|
||||
|
||||
template<typename _Tp>
|
||||
inline _Tp
|
||||
declval();
|
||||
|
||||
struct bad_alloc { };
|
||||
}
|
||||
|
||||
void* operator new(std::size_t) throw (std::bad_alloc);
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template<typename _Tp>
|
||||
class allocator
|
||||
{
|
||||
public:
|
||||
typedef _Tp* pointer;
|
||||
typedef _Tp value_type;
|
||||
|
||||
pointer
|
||||
allocate(size_t, const void* = 0);
|
||||
};
|
||||
|
||||
template<typename _Alloc>
|
||||
struct allocator_traits
|
||||
{
|
||||
typedef typename _Alloc::value_type value_type;
|
||||
|
||||
template<typename _Tp> static typename _Tp::pointer
|
||||
_S_pointer_helper(_Tp*);
|
||||
static value_type* _S_pointer_helper(...);
|
||||
typedef decltype(_S_pointer_helper((_Alloc*)0)) __pointer;
|
||||
|
||||
typedef __pointer pointer;
|
||||
|
||||
typedef const void* const_void_pointer;
|
||||
|
||||
private:
|
||||
template<typename _Alloc2>
|
||||
struct __allocate_helper
|
||||
{
|
||||
template<typename _Alloc3,
|
||||
typename = decltype(std::declval<_Alloc3*>()->allocate(
|
||||
std::declval<size_t>(),
|
||||
std::declval<const_void_pointer>()))>
|
||||
static true_type __test(int);
|
||||
|
||||
template<typename>
|
||||
static false_type __test(...);
|
||||
|
||||
typedef decltype(__test<_Alloc>(0)) type;
|
||||
static const bool value = type::value;
|
||||
};
|
||||
|
||||
template<typename _Alloc2>
|
||||
static typename
|
||||
enable_if<__allocate_helper<_Alloc2>::value, pointer>::type
|
||||
_S_allocate(_Alloc2& __a, size_t __n, const_void_pointer __hint)
|
||||
{ return __a.allocate(__n, __hint); }
|
||||
|
||||
public:
|
||||
static pointer
|
||||
allocate(_Alloc& __a, size_t __n, const_void_pointer __hint)
|
||||
{ return _S_allocate(__a, __n, __hint); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace std
|
||||
{
|
||||
typedef short test_type;
|
||||
template struct allocator_traits<allocator<test_type>>;
|
||||
}
|
Loading…
Add table
Reference in a new issue