[Bug c++/85775] False positive with -Wparentheses

2023-03-24 Thread markus-t314 at gmx dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85775

--- Comment #3 from markus  ---
Worked until 7.5, fails since 8.1 and still fails in 12.2

[Bug c++/85775] False positive with -Wparentheses

2023-03-24 Thread markus-t314 at gmx dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85775

markus  changed:

   What|Removed |Added

 CC||markus-t314 at gmx dot de

--- Comment #2 from markus  ---
Maybe a simpler example:

struct Foo {
int num;
};

struct S {
static Foo f;
};

// error: 'S' in 'struct Foo' does not name a type
//Foo ::S::f = Foo{23};

// warning: unnecessary parentheses in declaration of 'f' [-Wparentheses]
Foo (::S::f) = Foo{23};


Parantheses are necessary if global scope resolution is wanted/needed,
otherwise they would refer to the class Foo.

https://godbolt.org/z/7d39rbv7o

[Bug c++/109083] New: Incorrect static_assert shown in diagnostics

2023-03-09 Thread markus-t314 at gmx dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109083

Bug ID: 109083
   Summary: Incorrect static_assert shown in diagnostics
   Product: gcc
   Version: 12.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: markus-t314 at gmx dot de
  Target Milestone: ---

Code:

#include 

template
void unused_function()
{
static_assert(std::is_member_function_pointer::value,
"Line 6");
}

template
void fail_here()
{
static_assert(std::is_member_function_pointer::value,
"Line 12");
}

int main()
{
fail_here();
}



This fails correctly, but the wrong static assertion is given in diagnostics:

main.cpp: In instantiation of ‘void fail_here() [with T = int]’:
main.cpp:17:19:   required from here
main.cpp:6:60: error: ‘foo’ is not a member of ‘int’
6 |
static_assert(std::is_member_function_pointer::value, "Line
6");
  |


https://godbolt.org/z/6Yrc9x6Ws


Might be related to bug 66968