[Bug c++/58091] New: Non-ambiguous member lookup rejected

2013-08-05 Thread fimbul77 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58091

Bug ID: 58091
   Summary: Non-ambiguous member lookup rejected
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: fimbul77 at gmail dot com

The following code is rejected:

namespace NS
{
template < int N >
struct NS
{
constexpr static int value = N ;
} ;
}

int main()
{
using namespace NS ;
NS<0>::value ;
// gcc says a name 'NS' is ambiguous.
// clang says 'NS' is class template name NS::NS ;
}

I think NS<0>::value is not ambiguous.
Because namespace is uncomparable and can not be template.


[Bug c++/58091] Non-ambiguous member lookup rejected

2013-08-06 Thread fimbul77 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58091

--- Comment #2 from fimbul77 at gmail dot com ---
3.4 Name lookup
The name lookup rules apply uniformly to all names (including typedef-names
(7.1.3), namespace-names (7.3), and class-names (9.1)) wherever the grammar
allows such names in the context discussed by a particular rule.

NS<0>::value

NS(namespace) should not be lookup(the grammar don't allow appearing angle
brackets after namespace name).
Only NS(class template) should be lookup.

Perhaps Clang is correct.


[Bug c++/58181] New: A bug in lambda expression

2013-08-17 Thread fimbul77 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58181

Bug ID: 58181
   Summary: A bug in lambda expression
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: fimbul77 at gmail dot com

Following the code:

#include 
#include 

int main()
{
assert(std::get<0>(
[]() {
int x = 0;
return std::forward_as_tuple([=]() -> int {
return x;
});
}()
)() == 0);
}

The assertion fails in gcc.(but only gcc4.6.4 succeed it)
But I think it must be success.
The variable x in [=]() -> int { return x; } should not garbage.
It may be a lambda expression bug.

Wandbox
http://melpon.org/wandbox/permlink/MRhUXl888hCZAQcx


[Bug c++/58181] A bug in lambda expression

2013-08-17 Thread fimbul77 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58181

--- Comment #1 from fimbul77 at gmail dot com ---
sorry, my code was wrond.

Following the code :
#include 
#include 

int main()
{
static const auto factory = []() {
int x = 0;

return [=]() mutable {
return std::forward_as_tuple(
   [&]() -> int { return x; }
   );
};
};

auto f1 = factory();
assert(std::get<0>(f1())() == 0); // f1.x == 0
}


[Bug c++/58181] A bug in lambda expression

2013-08-17 Thread fimbul77 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58181

fimbul77 at gmail dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #2 from fimbul77 at gmail dot com ---
 It was my mistake.