[Bug c++/63198] decltype in template function declaration yields spurious error

2014-11-03 Thread eightycc at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63198

--- Comment #2 from Bob Abeles  ---
This bug occurs when cp/parser.c:cp_parser_name() while parsing 'decltype(y =
y)::t1' is called on 't1'. Earlier, the decltype has been determined to be
dependent (it isn't actually in this case, but doing so appears to be a
reasonable simplification), so cp_parser_name() defers the look up and returns
the result of cp/tree.c:build_qualified_name(). 

The calling routine, cp/parser.c:cp_parser_class_name() fails to handle this
case, returning an error_mark_node.


[Bug c++/63198] New: [c++1y] decltype in template function declaration yields spurious error

2014-09-07 Thread eightycc at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63198

Bug ID: 63198
   Summary: [c++1y] decltype in template function declaration
yields spurious error
   Product: gcc
   Version: 4.9.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: eightycc at gmail dot com

Created attachment 33455
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33455&action=edit
reproduces decltype bug

Attempting to use decltype to name an argument type in a template function
declaration results in a spurious error message. For example,

// Reproduce decltype bug, condensed from Spirit X3
// gcc 4.9.1 fails to identify f1's declaration
template 
struct s1;
template 
struct s2 {
  typedef s1 t1;
};
template 
struct s1 {
  template 
  s2 operator = (T2 const &) const;
};

struct T;
s1 v1;
s2 v2;
template 
void f1(decltype(v1 = v2)::t1);

Compiling this yields:

blackice:decltype-bug rabeles$
~/Development/gcc/gcc-4.9.1-baseline-build/gcc/cc1plus test1.cpp --std=c++1y
test1.cpp:19:30: error: variable or field ‘f1’ declared void
 void f1(decltype(v1 = v2)::t1);