mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-15 11:40:57 +08:00
re PR c++/31671 (Non-type template of type const ref accepted as a non-const ref)
/cp 2013-10-11 Paolo Carlini <paolo.carlini@oracle.com> PR c++/31671 * pt.c (convert_nontype_argument): Set expr_type to TREE_TYPE (probe_type). /testsuite 2013-10-11 Paolo Carlini <paolo.carlini@oracle.com> PR c++/31671 * g++.dg/template/nontype26.C: New. From-SVN: r203444
This commit is contained in:
parent
3c87b77b1e
commit
ddc757fe19
@ -1,3 +1,9 @@
|
||||
2013-10-11 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/31671
|
||||
* pt.c (convert_nontype_argument): Set expr_type to
|
||||
TREE_TYPE (probe_type).
|
||||
|
||||
2013-10-11 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* decl.c (duplicate_decls): Error out for redeclaration of UDRs.
|
||||
|
@ -5611,7 +5611,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
|
||||
TREE_TYPE (TREE_TYPE (addr)))))
|
||||
{
|
||||
expr = TREE_OPERAND (addr, 0);
|
||||
expr_type = TREE_TYPE (expr);
|
||||
expr_type = TREE_TYPE (probe_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
2013-10-11 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/31671
|
||||
* g++.dg/template/nontype26.C: New.
|
||||
|
||||
2013-10-11 Thomas Schwinge <thomas@codesourcery.com>
|
||||
|
||||
* c-c++-common/cpp/openmp-define-1.c: New file.
|
||||
|
20
gcc/testsuite/g++.dg/template/nontype26.C
Normal file
20
gcc/testsuite/g++.dg/template/nontype26.C
Normal file
@ -0,0 +1,20 @@
|
||||
// PR c++/31671
|
||||
|
||||
template<int& i> void doit() {
|
||||
i = 0;
|
||||
}
|
||||
|
||||
template<const int& i> class X {
|
||||
public:
|
||||
void foo() {
|
||||
doit<i>(); // { dg-error "cv-qualification|no matching" }
|
||||
}
|
||||
};
|
||||
|
||||
int i = 0;
|
||||
|
||||
X<i> x;
|
||||
|
||||
int main() {
|
||||
x.foo();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user