PR c++/40307
* decl.c (cp_finish_decl): Handle auto deduction from ().
* typeck.c (build_x_indirect_ref): Handle dereferencing an operand
with dependent type that is known to be a pointer.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148088
138bc75d-0d04-0410-961f-
82ee72b054a4
+2009-06-01 Jason Merrill <jason@redhat.com>
+
+ PR c++/40306
+ PR c++/40307
+ * decl.c (cp_finish_decl): Handle auto deduction from ().
+ * typeck.c (build_x_indirect_ref): Handle dereferencing an operand
+ with dependent type that is known to be a pointer.
+
2009-06-02 Simon Martin <simartin@users.sourceforge.net>
PR c++/38089
TREE_TYPE (decl) = error_mark_node;
return;
}
- else if (describable_type (init))
+ if (TREE_CODE (init) == TREE_LIST)
+ init = build_x_compound_expr_from_list (init, "initializer");
+ if (describable_type (init))
{
type = TREE_TYPE (decl) = do_auto_deduction (type, init, auto_node);
if (type == error_mark_node)
if (processing_template_decl)
{
+ /* Retain the type if we know the operand is a pointer so that
+ describable_type doesn't make auto deduction break. */
+ if (TREE_TYPE (expr) && POINTER_TYPE_P (TREE_TYPE (expr)))
+ return build_min (INDIRECT_REF, TREE_TYPE (TREE_TYPE (expr)), expr);
if (type_dependent_expression_p (expr))
return build_min_nt (INDIRECT_REF, expr);
expr = build_non_dependent_expr (expr);
+2009-06-02 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/auto14.C: New.
+
2009-06-02 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/alignment6.adb: Remove XFAIL.
--- /dev/null
+// PR c++/40306, c++/40307
+// { dg-options "-std=c++0x" }
+// { dg-do run }
+
+template< typename T >
+struct test {
+ test run() {
+ auto tmp = *this;
+ return tmp;
+ }
+ test run_pass() {
+ test tmp( *this );
+ return tmp;
+ }
+
+ test run_fail() {
+ auto tmp( *this );
+ return tmp;
+ }
+};
+
+int main()
+{
+ test<int> x;
+ x.run();
+ x.run_pass();
+ x.run_fail();
+ return 0;
+}