[Bug c++/68374] G++ -Wshadow doesn't warn about static member shadowing

2018-02-12 Thread xyzdragon at fastmail dot fm
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68374

xyzdragon at fastmail dot fm changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from xyzdragon at fastmail dot fm ---
(In reply to Paolo Carlini from comment #1)
> This is already fixed in trunk. I'm adding a testcase and closing the bug.

What do you mean with trunk? It still doesn't warn for 

g++-4.9 (Debian 4.9.4-2) 4.9.4`
g++-5 (Debian 5.4.1-4) 5.4.1 20161202`
g++-5 (Debian 5.5.0-8) 5.5.0 20171010`
g++-6 (Debian 6.3.0-18) 6.3.0 20170516`
g++-6 (Debian 6.4.0-12) 6.4.0 20180123`
g++-7 (Debian 7.2.0-16) 7.2.0`
g++-7 (Debian 7.3.0-3) 7.3.0`

Ah okay this version does work:

g++-8 (Debian 8-20180207-2) 8.0.1 20180207 (experimental) [trunk revision
257435]

although I don't see why this can't be a minor version bugfix in the older
major versions:

shadowtest.cpp: In member function ‘int f::g(int)’:
shadowtest.cpp:3:24: warning: declaration of ‘mVar’ shadows a previous
local [-Wshadow]
 int g(int x) { int mVar=3; return x+mVar; }
^~~~
shadowtest.cpp:2:16: note: shadowed declaration is here
 static int mVar;
^~~~

Btw offtopic, aren't all these major version upgrades too much too fast? I've
lost quite a bit of time, because my system didn't work with g++5 (kernel
module didn't compile), or because CUDA didn't, or because I had
ABI-incompatibility bugs, because I linked code compiled with different
compiler compilers accidentally and the list goes on ...

[Bug c++/70213] New: Not all ambiguous cases of method constraint overloading caught?

2016-03-12 Thread xyzdragon at fastmail dot fm
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70213

Bug ID: 70213
   Summary: Not all ambiguous cases of method constraint
overloading caught?
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: xyzdragon at fastmail dot fm
  Target Milestone: ---

I'm really a complete novice on the topic of concepts, but I read
  http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3701.pdf
and on page 5 it introduces constraints for class methods.

#include 

class A {};

template bool constexpr isConst() { return false; }
template<> bool constexpr isConst() { return true; }

template
struct B {
void echo(void) requires isConst()
{ std::cout << "isConst" << std::endl; };

void echo(void) requires isConst() && true
{ std::cout << "isConst && true" << std::endl; };

/*
concepts.cpp:131:13: error: call of overloaded 'echo()' is ambiguous
 ba.echo();
=> weirdly the above two functions don't return such ambiguity ...
*/
//void echo(void) requires isConst() && true && true;

void echo(void) requires isConst() && true || false
{ std::cout << "isConst && true || false" << std::endl; };
};

int main( void )
{
B ba;
ba.echo();

return 0;
}

If I don't have a complete brainfreeze at the moment, then (x && true) should
be identical to (x) and (x || false) should be identical to (x). The compiler
doesn't seem to notice that. Furthermore I don't understand why (requires x &&
true) is preferred over (requires x && true || false) and (requires x)

I'm using /opt/gcc-6/bin/g++ --version
  g++ (GCC) 6.0.0 20151213 (experimental)
  Copyright (C) 2015 Free Software Foundation, Inc.

[Bug c++/70213] Not all ambiguous cases of method constraint overloading caught?

2016-03-12 Thread xyzdragon at fastmail dot fm
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70213

--- Comment #1 from xyzdragon at fastmail dot fm ---
I just noticed, that as a workaround the it works to change
isConst()

[Bug c++/70213] Not all ambiguous cases of method constraint overloading caught?

2016-03-12 Thread xyzdragon at fastmail dot fm
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70213

--- Comment #2 from xyzdragon at fastmail dot fm ---
to
  bool( isConst() )
even though this shouldn't be necessary, because isConst already has return
type bool.

(Sorry for split post, I accidentally pressed the send button)

[Bug libstdc++/45896] [C++0x] Facet time_get not reading dates according to the IEEE 1003 standard.

2017-07-14 Thread xyzdragon at fastmail dot fm
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45896

xyzdragon at fastmail dot fm changed:

   What|Removed |Added

 CC||xyzdragon at fastmail dot fm

--- Comment #7 from xyzdragon at fastmail dot fm ---
Had this bug when trying "%m" formatter on input "7" input. Saw the comment
from 7 years ago "Can fix pretty quickly." and let out a desperate laugh. Is
C++11 dead?

[Bug c++/68374] New: G++ -Wshadow doesn't warn about static member shadowing

2015-11-16 Thread xyzdragon at fastmail dot fm
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68374

Bug ID: 68374
   Summary: G++ -Wshadow doesn't warn about static member
shadowing
   Product: gcc
   Version: 5.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: xyzdragon at fastmail dot fm
  Target Milestone: ---

This bug seems to be related to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45615 but the code example is a
bit different, so I'm not sure. Delete this if necessary.

This is the source code in question:

class f {
static int mVar;
int g(int x) { int mVar=3; return x+mVar; }
};
int f::mVar = 1;

The problem is, that I accidentally added int in front of mVar. When I compile
this with:
  g++ -c -Wall -Wextra -Wshadow shadowtest.cpp
I don't get any warning, about the local mVar shadowing the static member mVar.

But if I don't declare the member variable to be static, then g++ correctly
issues a warning:

class f {
int mVar;
f(int rVar) : mVar(rVar) {};
int g(int x) { int mVar=3; return x+mVar; }
};

compile with g++ -c -Wall -Wextra -Wshadow shadowtest2.cpp gets:

shadowtest2.cpp:5:24: warning: declaration of ‘mVar’ shadows a member of ‘f’
[-Wshadow]
 int g(int x) { int mVar=3; return x+mVar; }
^
shadowtest2.cpp:3:9: note: shadowed declaration is here
 int mVar;
 ^

Note, as pointed out by other stack users
http://stackoverflow.com/questions/33739066/ and also tested myself clang++
behaves like I would have expected g++ to behave, that's why I'm filing this as
a bug.

The above behavior is the same in g++ 4.9.2 and g++ 5.2.1-17