mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-24 07:39:13 +08:00
c++: auto and dependent member name [PR105734]
In r12-3643 I improved our handling of type names after . or -> when unqualified lookup doesn't find anything, but it needs to handle auto specially. PR c++/105734 gcc/cp/ChangeLog: * parser.cc (cp_parser_postfix_dot_deref_expression): Use typeof if the expression has auto type. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/auto57.C: New test.
This commit is contained in:
parent
72e52b8858
commit
e2e471d83d
@ -8262,7 +8262,7 @@ cp_parser_postfix_dot_deref_expression (cp_parser *parser,
|
||||
tree type = TREE_TYPE (postfix_expression);
|
||||
/* If we don't have a (type-dependent) object of class type, use
|
||||
typeof to figure out the type of the object. */
|
||||
if (type == NULL_TREE)
|
||||
if (type == NULL_TREE || is_auto (type))
|
||||
type = finish_typeof (postfix_expression);
|
||||
parser->context->object_type = type;
|
||||
}
|
||||
|
15
gcc/testsuite/g++.dg/cpp0x/auto57.C
Normal file
15
gcc/testsuite/g++.dg/cpp0x/auto57.C
Normal file
@ -0,0 +1,15 @@
|
||||
// PR c++/105734
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
namespace N {
|
||||
struct A { };
|
||||
A f(A);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void bar() {
|
||||
auto m = f(T());
|
||||
m.~A();
|
||||
}
|
||||
|
||||
void foo() { bar<N::A>(); }
|
Loading…
Reference in New Issue
Block a user