[Bug c++/60986] New: Wrong handling of const variables in lambda functions

2014-04-28 Thread physik3 at gmx dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60986

Bug ID: 60986
   Summary: Wrong handling of const variables in lambda functions
   Product: gcc
   Version: 4.7.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: physik3 at gmx dot net

The code in the attachment compiles, but behaves in a strange way. Output is


a = 42
b = 0
b = 0
b = 42


expected (and achieved if the function is not templated):


a = 42
b = 42
b = 42
b = 42



[Bug c++/60986] Wrong handling of const variables in lambda functions

2014-04-28 Thread physik3 at gmx dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60986

--- Comment #1 from physik3 at gmx dot net ---
Created attachment 32694
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32694&action=edit
file containing the code


[Bug c++/67621] New: Syntax error for template function of template class

2015-09-18 Thread physik3 at gmx dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67621

Bug ID: 67621
   Summary: Syntax error for template function of template class
   Product: gcc
   Version: 5.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: physik3 at gmx dot net
  Target Milestone: ---

Hey guys,

I think I have found a bug in the GCC C++ frontend.

I have a template class which provides a function with additional template
parameters. This works fine if the class is parameterized with a non-template
type or a template type whose arguments are fixed, but the compiler throws a
syntax error if the class is parameterized with a template class itself whose
argument is open.

I could downsize the problem to the following minimal example:

template
struct Foo {

template void foo(void) {}

};

template
struct Bar {

};

int main(void) {
Foo foo1;
foo1.foo(); // this line works
Foo> foo2;
foo2.foo(); // this line works
return 0;
}

template
void baz(void) {
Foo> foo;
foo.foo(); // this line gives a compiler error
}


GCC quits with "error: expected ‘;’ before ‘int’". Because I cannot see any
syntactical error, I guess it is a bug in GCC. Moreover, the Visual Studio
compiler accepts this code.

I detected this working with version 4.8.3, but I verified that it also affects
the newer 5.2.1 release.

Best

[Bug c++/67621] Syntax error for template function of template class

2015-09-18 Thread physik3 at gmx dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67621

--- Comment #2 from physik3 at gmx dot net ---
Hi.

(In reply to Jonathan Wakely from comment #1)
> (In reply to physik3 from comment #0)
> > foo.foo(); // this line gives a compiler error
> 
> This needs to be:
> 
> foo.template foo();
> 
> See https://womble.decadent.org.uk/c++/template-faq.html#disambiguation

Thank you, you are completely right.

Would it be hard to implement that GCC prints a message like "Did you forget
keyword template?" in this situation?

[Bug c++/64627] New: Internal compiler error: Segmentation fault

2015-01-16 Thread physik3 at gmx dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64627

Bug ID: 64627
   Summary: Internal compiler error: Segmentation fault
   Product: gcc
   Version: 4.7.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: physik3 at gmx dot net

Created attachment 34462
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34462&action=edit
source file from openVDB library

Hi everyone.

When I try to build openVDB (http://www.openvdb.org/download/) and compile the
file openvdb.cc, GCC crashes with a segmentation fault. As the message asks me
to submit a bug report, I am doing so now.

Error message (I am building on a German system; "Speicherzugriffsfehler" means
segmentation fault):

=
In file included from ../openvdb/tree/Tree.h:53:0,
 from Grid.h:43,
 from openvdb.h:39,
 from openvdb.cc:31:
../openvdb/tree/TreeIterator.h: In instantiation of ‘class
openvdb::v3_0_0::tree::IterListItem, 3u>, 4u>, 5u> > >,
openvdb::v3_0_0::tree::RootNode, 3u>, 4u>, 5u>
>::ChildIter, 3u>, 4u>, 5u> >, std::_Rb_tree_iterator, 3u>, 4u>, 5u> >::NodeStruct> >,
openvdb::v3_0_0::tree::RootNode, 3u>, 4u>, 5u> >::ChildOnPred,
openvdb::v3_0_0::tree::InternalNode, 3u>, 4u>, 5u> > >::PrevItem,
boost::mpl::v_item, 3u>, 4u>, 5u> >,
boost::mpl::v_item, 3u>, 4u>, 5u>,
boost::mpl::vector2, 3u>,
openvdb::v3_0_0::tree::InternalNode, 3u>, 4u> >, 0>, 0>, 4ul, 0u>’:
../openvdb/tree/TreeIterator.h:1296:76:   required from ‘class
openvdb::v3_0_0::tree::LeafIteratorBase, 3u>, 4u>, 5u> > >,
openvdb::v3_0_0::tree::RootNode, 3u>, 4u>, 5u>
>::ChildIter, 3u>, 4u>, 5u> >, std::_Rb_tree_iterator, 3u>, 4u>, 5u> >::NodeStruct> >,
openvdb::v3_0_0::tree::RootNode, 3u>, 4u>, 5u> >::ChildOnPred,
openvdb::v3_0_0::tree::InternalNode, 3u>, 4u>, 5u> > >’
../openvdb/tree/Tree.h:1681:19:   required from ‘void
openvdb::v3_0_0::tree::Tree<_RootNodeType>::clipUnallocatedNodes() [with
_RootNodeType =
openvdb::v3_0_0::tree::RootNode, 3u>, 4u>, 5u> >]’
openvdb.cc:168:1:   required from here
../openvdb/tree/TreeIterator.h:441:40: internal compiler error:
Speicherzugriffsfehler
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugs.opensuse.org/> for instructions.
=

Greetings

[Bug c++/64627] Internal compiler error: Segmentation fault

2015-01-21 Thread physik3 at gmx dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64627

physik3 at gmx dot net changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |FIXED

--- Comment #2 from physik3 at gmx dot net ---
Sorry for answering only now, but for updating my GCC, I had to upgrade my
openSUSE version and that unfortunately destroyed it.

I compiled the openVDB code on another machine with new GCC (4.8.1) and that
worked for the file mentioned above. So I guess that bug has already been
fixed.