mirror of
https://gcc.gnu.org/git/gcc.git
synced 2025-01-13 14:33:45 +08:00
re PR c++/57419 (Access control doesn't stop referring to a deleted function)
/gcc/cp 2013-06-03 Paolo Carlini <paolo.carlini@oracle.com> PR c++/57419 * decl2.c (mark_used): Add overload taking a tsubst_flags_t too. * semantics.c (finish_qualified_id_expr): Use it. * cp-tree.h: Update. /gcc/testsuite 2013-06-03 Paolo Carlini <paolo.carlini@oracle.com> PR c++/57419 * g++.dg/cpp0x/sfinae46.C: New. * g++.dg/cpp0x/defaulted13.C: Adjust. * g++.dg/cpp0x/defaulted2.C: Likewise. * g++.dg/cpp0x/defaulted26.C: Likewise. * g++.dg/cpp0x/defaulted3.C: Likewise. * g++.dg/cpp0x/error1.C: Likewise. * g++.dg/cpp0x/implicit1.C: Likewise. * g++.dg/cpp0x/implicit11.C: Likewise. * g++.dg/cpp0x/inh-ctor13.C: Likewise. * g++.dg/cpp0x/initlist47.C: Likewise. * g++.dg/cpp0x/initlist9.C: Likewise. * g++.dg/cpp0x/lambda/lambda-errloc.C: Likewise. * g++.dg/cpp0x/lambda/lambda-errloc2.C: Likewise. * g++.dg/cpp0x/nsdmi-local.C: Likewise. * g++.dg/cpp0x/union4.C: Likewise. * g++.dg/template/crash108.C: Likewise. * g++.dg/template/crash41.C: Likewise. * g++.old-deja/g++.jason/local.C: Likewise. * g++.old-deja/g++.law/visibility3.C: Likewise. /libstdc++-v3 2013-06-03 Paolo Carlini <paolo.carlini@oracle.com> PR c++/57419 * testsuite/20_util/default_delete/48631_neg.cc: Adjust. From-SVN: r199626
This commit is contained in:
parent
53984b9b4c
commit
2e6491515e
@ -1,3 +1,10 @@
|
|||||||
|
2013-06-03 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
|
PR c++/57419
|
||||||
|
* decl2.c (mark_used): Add overload taking a tsubst_flags_t too.
|
||||||
|
* semantics.c (finish_qualified_id_expr): Use it.
|
||||||
|
* cp-tree.h: Update.
|
||||||
|
|
||||||
2013-06-01 Jan Hubicka <jh@suse.cz>
|
2013-06-01 Jan Hubicka <jh@suse.cz>
|
||||||
|
|
||||||
* decl2.c (cp_write_global_declarations): Replace same_body_alias
|
* decl2.c (cp_write_global_declarations): Replace same_body_alias
|
||||||
|
@ -5278,6 +5278,7 @@ extern bool decl_constant_var_p (tree);
|
|||||||
extern bool decl_maybe_constant_var_p (tree);
|
extern bool decl_maybe_constant_var_p (tree);
|
||||||
extern void check_default_args (tree);
|
extern void check_default_args (tree);
|
||||||
extern bool mark_used (tree);
|
extern bool mark_used (tree);
|
||||||
|
extern bool mark_used (tree, tsubst_flags_t);
|
||||||
extern void finish_static_data_member_decl (tree, tree, bool, tree, int);
|
extern void finish_static_data_member_decl (tree, tree, bool, tree, int);
|
||||||
extern tree cp_build_parm_decl (tree, tree);
|
extern tree cp_build_parm_decl (tree, tree);
|
||||||
extern tree get_guard (tree);
|
extern tree get_guard (tree);
|
||||||
|
@ -4499,7 +4499,7 @@ possibly_inlined_p (tree decl)
|
|||||||
wrong, true otherwise. */
|
wrong, true otherwise. */
|
||||||
|
|
||||||
bool
|
bool
|
||||||
mark_used (tree decl)
|
mark_used (tree decl, tsubst_flags_t complain)
|
||||||
{
|
{
|
||||||
/* If DECL is a BASELINK for a single function, then treat it just
|
/* If DECL is a BASELINK for a single function, then treat it just
|
||||||
like the DECL for the function. Otherwise, if the BASELINK is
|
like the DECL for the function. Otherwise, if the BASELINK is
|
||||||
@ -4537,9 +4537,12 @@ mark_used (tree decl)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
error ("use of deleted function %qD", decl);
|
if (complain & tf_error)
|
||||||
if (!maybe_explain_implicit_delete (decl))
|
{
|
||||||
error_at (DECL_SOURCE_LOCATION (decl), "declared here");
|
error ("use of deleted function %qD", decl);
|
||||||
|
if (!maybe_explain_implicit_delete (decl))
|
||||||
|
inform (DECL_SOURCE_LOCATION (decl), "declared here");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4552,7 +4555,8 @@ mark_used (tree decl)
|
|||||||
{
|
{
|
||||||
if (!processing_template_decl && type_uses_auto (TREE_TYPE (decl)))
|
if (!processing_template_decl && type_uses_auto (TREE_TYPE (decl)))
|
||||||
{
|
{
|
||||||
error ("use of %qD before deduction of %<auto%>", decl);
|
if (complain & tf_error)
|
||||||
|
error ("use of %qD before deduction of %<auto%>", decl);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -4701,4 +4705,10 @@ mark_used (tree decl)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
mark_used (tree decl)
|
||||||
|
{
|
||||||
|
return mark_used (decl, tf_warning_or_error);
|
||||||
|
}
|
||||||
|
|
||||||
#include "gt-cp-decl2.h"
|
#include "gt-cp-decl2.h"
|
||||||
|
@ -1778,8 +1778,9 @@ finish_qualified_id_expr (tree qualifying_class,
|
|||||||
if (error_operand_p (expr))
|
if (error_operand_p (expr))
|
||||||
return error_mark_node;
|
return error_mark_node;
|
||||||
|
|
||||||
if (DECL_P (expr) || BASELINK_P (expr))
|
if ((DECL_P (expr) || BASELINK_P (expr))
|
||||||
mark_used (expr);
|
&& !mark_used (expr, complain))
|
||||||
|
return error_mark_node;
|
||||||
|
|
||||||
if (template_p)
|
if (template_p)
|
||||||
check_template_keyword (expr);
|
check_template_keyword (expr);
|
||||||
|
@ -1,3 +1,26 @@
|
|||||||
|
2013-06-03 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
|
PR c++/57419
|
||||||
|
* g++.dg/cpp0x/sfinae46.C: New.
|
||||||
|
* g++.dg/cpp0x/defaulted13.C: Adjust.
|
||||||
|
* g++.dg/cpp0x/defaulted2.C: Likewise.
|
||||||
|
* g++.dg/cpp0x/defaulted26.C: Likewise.
|
||||||
|
* g++.dg/cpp0x/defaulted3.C: Likewise.
|
||||||
|
* g++.dg/cpp0x/error1.C: Likewise.
|
||||||
|
* g++.dg/cpp0x/implicit1.C: Likewise.
|
||||||
|
* g++.dg/cpp0x/implicit11.C: Likewise.
|
||||||
|
* g++.dg/cpp0x/inh-ctor13.C: Likewise.
|
||||||
|
* g++.dg/cpp0x/initlist47.C: Likewise.
|
||||||
|
* g++.dg/cpp0x/initlist9.C: Likewise.
|
||||||
|
* g++.dg/cpp0x/lambda/lambda-errloc.C: Likewise.
|
||||||
|
* g++.dg/cpp0x/lambda/lambda-errloc2.C: Likewise.
|
||||||
|
* g++.dg/cpp0x/nsdmi-local.C: Likewise.
|
||||||
|
* g++.dg/cpp0x/union4.C: Likewise.
|
||||||
|
* g++.dg/template/crash108.C: Likewise.
|
||||||
|
* g++.dg/template/crash41.C: Likewise.
|
||||||
|
* g++.old-deja/g++.jason/local.C: Likewise.
|
||||||
|
* g++.old-deja/g++.law/visibility3.C: Likewise.
|
||||||
|
|
||||||
2013-06-03 Teresa Johnson <tejohnson@google.com>
|
2013-06-03 Teresa Johnson <tejohnson@google.com>
|
||||||
|
|
||||||
* gcc.dg/vect/bb-slp-31.c: Update vect dump message.
|
* gcc.dg/vect/bb-slp-31.c: Update vect dump message.
|
||||||
|
@ -7,13 +7,13 @@ struct NonCopyable {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
NonCopyable<int>::NonCopyable(NonCopyable<int> const&) = delete; // { dg-error "declared" }
|
NonCopyable<int>::NonCopyable(NonCopyable<int> const&) = delete; // { dg-message "declared" }
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
NonCopyable<T>::NonCopyable(NonCopyable<T> const&) = default;
|
NonCopyable<T>::NonCopyable(NonCopyable<T> const&) = default;
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
NonCopyable<double>::NonCopyable(NonCopyable<double> const&) = delete; // { dg-error "declared" }
|
NonCopyable<double>::NonCopyable(NonCopyable<double> const&) = delete; // { dg-message "declared" }
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
@ -42,7 +42,7 @@ struct E
|
|||||||
struct F
|
struct F
|
||||||
{
|
{
|
||||||
F() = default;
|
F() = default;
|
||||||
F(const F&) = delete; // { dg-error "declared" }
|
F(const F&) = delete; // { dg-message "declared" }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct G
|
struct G
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// PR c++/49066
|
// PR c++/49066
|
||||||
// { dg-options -std=c++0x }
|
// { dg-options -std=c++0x }
|
||||||
|
|
||||||
void foo() = delete; // { dg-error "declared here" }
|
void foo() = delete; // { dg-message "declared here" }
|
||||||
void foo();
|
void foo();
|
||||||
|
|
||||||
int main() { foo(); } // { dg-error "deleted" }
|
int main() { foo(); } // { dg-error "deleted" }
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
template<class T>
|
template<class T>
|
||||||
struct A {
|
struct A {
|
||||||
template<class U>
|
template<class U>
|
||||||
bool operator==(const A<U>&) = delete; // { dg-error "declared" }
|
bool operator==(const A<U>&) = delete; // { dg-message "declared" }
|
||||||
operator bool () { return true; }
|
operator bool () { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// { dg-do compile }
|
// { dg-do compile }
|
||||||
// { dg-options "-std=c++0x" }
|
// { dg-options "-std=c++0x" }
|
||||||
|
|
||||||
template<int... N> void foo (int... x[N]) // { dg-error "int \\\[N\\\]\\.\\.\\. x" }
|
template<int... N> void foo (int... x[N]) // { dg-message "int \\\[N\\\]\\.\\.\\. x" }
|
||||||
{
|
{
|
||||||
struct A
|
struct A
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@ D d; // { dg-error "deleted" }
|
|||||||
|
|
||||||
struct E
|
struct E
|
||||||
{
|
{
|
||||||
~E() = delete; // { dg-error "declared here" }
|
~E() = delete; // { dg-message "declared here" }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct F
|
struct F
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
struct A
|
struct A
|
||||||
{
|
{
|
||||||
~A() = delete; // { dg-error "declared here" }
|
~A() = delete; // { dg-message "declared here" }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct B: A { }; // { dg-error "deleted" }
|
struct B: A { }; // { dg-error "deleted" }
|
||||||
|
@ -8,7 +8,7 @@ struct A
|
|||||||
|
|
||||||
struct C
|
struct C
|
||||||
{
|
{
|
||||||
C() = delete; // { dg-error "declared here" }
|
C() = delete; // { dg-message "declared here" }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct B: A, C
|
struct B: A, C
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// { dg-options -std=c++0x }
|
// { dg-options -std=c++0x }
|
||||||
|
|
||||||
struct A { ~A() = delete; }; // { dg-error "declared" }
|
struct A { ~A() = delete; }; // { dg-message "declared" }
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ struct b
|
|||||||
b() = default;
|
b() = default;
|
||||||
~b() = default;
|
~b() = default;
|
||||||
b& operator=(const b&) = delete;
|
b& operator=(const b&) = delete;
|
||||||
b(const b&) = delete; // { dg-error "declared" }
|
b(const b&) = delete; // { dg-message "declared" }
|
||||||
|
|
||||||
b(bool _t): t (_t) { }
|
b(bool _t): t (_t) { }
|
||||||
};
|
};
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
struct A
|
struct A
|
||||||
{
|
{
|
||||||
A();
|
A();
|
||||||
A(const A& a) = delete; // { dg-error "declared" }
|
A(const A& a) = delete; // { dg-message "declared" }
|
||||||
};
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
struct A {
|
struct A {
|
||||||
A();
|
A();
|
||||||
A(const A&) = delete; // { dg-error "declared" }
|
A(const A&) = delete; // { dg-message "declared" }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
int q = 1; // { dg-error "declared here" }
|
int q = 1; // { dg-message "declared here" }
|
||||||
struct test { int x = q; } instance; // { dg-error "local variable" }
|
struct test { int x = q; } instance; // { dg-error "local variable" }
|
||||||
}
|
}
|
||||||
|
13
gcc/testsuite/g++.dg/cpp0x/sfinae46.C
Normal file
13
gcc/testsuite/g++.dg/cpp0x/sfinae46.C
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// PR c++/57419
|
||||||
|
// { dg-do compile { target c++11 } }
|
||||||
|
|
||||||
|
template< typename q >
|
||||||
|
decltype( &q::f ) t( q ) {}
|
||||||
|
|
||||||
|
char t( ... ) { return {}; }
|
||||||
|
|
||||||
|
class c { void f() = delete; };
|
||||||
|
class d { static void f() = delete; };
|
||||||
|
|
||||||
|
static_assert( sizeof( t( c() ) ), "c" );
|
||||||
|
static_assert( sizeof( t( d() ) ), "d" );
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
struct SFoo
|
struct SFoo
|
||||||
{
|
{
|
||||||
SFoo() =delete; // { dg-error "declared" }
|
SFoo() =delete; // { dg-message "declared" }
|
||||||
};
|
};
|
||||||
|
|
||||||
union UFoo // { dg-error "deleted" }
|
union UFoo // { dg-error "deleted" }
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// PR c++/50861
|
// PR c++/50861
|
||||||
|
|
||||||
template<class T> struct A {A(int b=k(0));}; // { dg-error "parameter|arguments" }
|
template<class T> struct A {A(int b=k(0));}; // { dg-error "parameter|arguments" }
|
||||||
void f(int k){A<int> a;} // // { dg-error "declared" }
|
void f(int k){A<int> a;} // // { dg-message "declared" }
|
||||||
// { dg-message "note" "note" { target *-*-* } 3 }
|
// { dg-message "note" "note" { target *-*-* } 3 }
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// PR c++/22464
|
// PR c++/22464
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void do_something(const T* A) // { dg-error "declared" }
|
void do_something(const T* A) // { dg-message "declared" }
|
||||||
{
|
{
|
||||||
struct helper_t{
|
struct helper_t{
|
||||||
helper_t() {
|
helper_t() {
|
||||||
|
@ -5,7 +5,7 @@ int x;
|
|||||||
void f ()
|
void f ()
|
||||||
{
|
{
|
||||||
static int s;
|
static int s;
|
||||||
int x; // { dg-error "" } referenced below
|
int x; // { dg-message "" } referenced below
|
||||||
extern int q();
|
extern int q();
|
||||||
|
|
||||||
struct local {
|
struct local {
|
||||||
|
@ -11,7 +11,7 @@ int x;
|
|||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
static int s;
|
static int s;
|
||||||
int x; // { dg-error "" } declared
|
int x; // { dg-message "" } declared
|
||||||
extern int g();
|
extern int g();
|
||||||
|
|
||||||
struct local {
|
struct local {
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
|
2013-06-03 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
|
PR c++/57419
|
||||||
|
* testsuite/20_util/default_delete/48631_neg.cc: Adjust.
|
||||||
|
|
||||||
2013-06-01 Ed Smith-Rowland <3dw4rd@verizon.net>
|
2013-06-01 Ed Smith-Rowland <3dw4rd@verizon.net>
|
||||||
|
|
||||||
include/std/chrono: Collapse redundant 'inline' from 'inline constexpr'.
|
* include/std/chrono: Collapse redundant 'inline' from 'inline
|
||||||
include/std/tuple: Ditto.
|
constexpr'.
|
||||||
include/bits/move.h: Ditto.
|
* include/std/tuple: Ditto.
|
||||||
|
* include/bits/move.h: Ditto.
|
||||||
|
|
||||||
2013-05-30 Ed Smith-Rowland <3dw4rd@verizon.net>
|
2013-05-30 Ed Smith-Rowland <3dw4rd@verizon.net>
|
||||||
|
|
||||||
|
@ -27,4 +27,4 @@ struct D : B { };
|
|||||||
D d;
|
D d;
|
||||||
std::default_delete<B[]> db;
|
std::default_delete<B[]> db;
|
||||||
typedef decltype(db(&d)) type; // { dg-error "use of deleted function" }
|
typedef decltype(db(&d)) type; // { dg-error "use of deleted function" }
|
||||||
// { dg-error "declared here" "" { target *-*-* } 122 }
|
// { dg-prune-output "declared" }
|
||||||
|
Loading…
Reference in New Issue
Block a user