[Bug preprocessor/94948] New: Warn / fail on non-matching parentheses in a header file before including it

2020-05-05 Thread koncek.marian at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94948

Bug ID: 94948
   Summary: Warn / fail on non-matching parentheses in a header
file before including it
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: preprocessor
  Assignee: unassigned at gcc dot gnu.org
  Reporter: koncek.marian at gmail dot com
  Target Milestone: ---

Created attachment 48449
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48449&action=edit
Example

If a header file in a nontrivial project (especially in C++) happens to miss a
closing parenthesis (for example close a namespace) and this file is the
included in other TUs, the avalanche of error messages will make it hard to
locate the issue.
Yet GCC's preprocessor can very well detect it and warn against it.

However this would only make sense if the warning too was visible among the
other error messages.
When invoking the compiler from a build system doing multiple jobs, it may be
especially hard to make the warning visible. The user may also kill the whole
build.
So possibly a better solution is to make it a hard error, whether enabled or
disabled by default.

[Bug c++/98600] New: Pointer-to-member deduced type not accepted as template parameter

2021-01-08 Thread koncek.marian at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98600

Bug ID: 98600
   Summary: Pointer-to-member deduced type not accepted as
template parameter
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: koncek.marian at gmail dot com
  Target Milestone: ---

Created attachment 49918
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49918&action=edit
Example what GCC fails to compile

GCC is not able to compile function declared like this:

template
void f();

See this: https://godbolt.org/z/c6sbv3
(also attached)

Both Clang and GCC are able to compile f2, but GCC fails to compile the
function f1.

[Bug c++/98857] New: Add support for function attributes applied to function pointers from non-capturing lambdas

2021-01-27 Thread koncek.marian at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98857

Bug ID: 98857
   Summary: Add support for function attributes applied to
function pointers from non-capturing lambdas
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: koncek.marian at gmail dot com
  Target Milestone: ---

Created attachment 50070
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50070&action=edit
example

Since non-capturing lambda has to be convertible to a function pointer it may
be useful to be able to specify function attributes (such as
[[gnu::aligned(N)]]) which apply to the function pointer obtained from such
lambda.

Example use: https://godbolt.org/z/ds1G6z
(also attached)

Although this opens some questions about which attribute applies to any of the:
1) lambda object
2) member application function: &decltype(lambda)::operator()
3) function pointer from non-capturing lambdas

and where to place the attribute specifier.

[Bug c++/101800] New: mingw-64 link error with constexpr static variable definition

2021-08-06 Thread koncek.marian at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101800

Bug ID: 101800
   Summary: mingw-64 link error with constexpr static variable
definition
   Product: gcc
   Version: 10.3.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: koncek.marian at gmail dot com
  Target Milestone: ---

Version:
x86_64-w64-mingw32-g++ (GCC) 10.3.1 20210422 (Fedora MinGW 10.3.1-1.fc34)

Using 3 source files:



#pragma once

struct S
{
const static int value;
};



#include "test.hpp"

constexpr int S::value = 0;



#include "test.hpp"

int main()
{
return S::value;
}


Compile with:
$ x86_64-w64-mingw32-g++ -std=c++2a -c test.cpp && x86_64-w64-mingw32-g++
-std=c++2a test.o main.cpp

Results in:
/usr/lib/gcc/x86_64-w64-mingw32/10.3.1/../../../../x86_64-w64-mingw32/bin/ld:
/tmp/ccANpWMi.o:main.cpp:(.rdata$.refptr._ZN1S5valueE[.refptr._ZN1S5valueE]+0x0):
undefined reference to `S::value'
collect2: error: ld returned 1 exit status

Whereas plain g++ is able to link the files in the executable.

Changing the `constexpr` definition to `const` makes mingw link the files
successfully.