[Bug libstdc++/64967] New: [5 Regression] Bootstrap fails due to errors in libstdc++ sources with `--enable-symvers=gnu-versioned-namespace'

2015-02-07 Thread ai.azuma at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64967

Bug ID: 64967
   Summary: [5 Regression] Bootstrap fails due to errors in
libstdc++ sources with
`--enable-symvers=gnu-versioned-namespace'
   Product: gcc
   Version: 5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ai.azuma at gmail dot com

Compile errors occur in stage 1 build of libstdc++ when trying to build GCC
5-20150201 with the following commands on an x86_64-unknown-linux-gnu machine
(Ubuntu 14.04 LTS):

  $ $SRCDIR/configure --enable-languages=c,c++
--enable-symvers=gnu-versioned-namespace
  $ make

The actual error messages are too long to paste here, but the very beginning of
them are:

/home/cryolite/work/gcc-bugs/20150207/objdir/./gcc/xgcc -shared-libgcc
-B/home/cryolite/work/gcc-bugs/20150207/objdir/./gcc -nostdinc++
-L/home/cryolite/work/gcc-bugs/20150207/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/src
-L/home/cryolit
e/work/gcc-bugs/20150207/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
-L/home/cryolite/work/gcc-bugs/20150207/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
-B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86
_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include
-isystem /usr/local/x86_64-unknown-linux-gnu/sys-include-x c++-header
-nostdinc++ -g -O2 -D_GNU_SOURCE 
-I/home/cryolite/work/gcc-bugs/20150207/objdir/x86_6
4-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu
-I/home/cryolite/work/gcc-bugs/20150207/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/include
-I/home/cryolite/work/gcc-bugs/20150207/gcc-5-20150201/libstdc++-v3/libsupc++
-O2
 -g -std=gnu++0x
/home/cryolite/work/gcc-bugs/20150207/gcc-5-20150201/libstdc++-v3/include/precompiled/stdc++.h
\
-o x86_64-unknown-linux-gnu/bits/stdc++.h.gch/O2ggnu++0x.gch
In file included from
/home/cryolite/work/gcc-bugs/20150207/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/include/ios:38:0,
 from
/home/cryolite/work/gcc-bugs/20150207/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/include/istream:38,
 from
/home/cryolite/work/gcc-bugs/20150207/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/include/sstream:38,
 from
/home/cryolite/work/gcc-bugs/20150207/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/include/complex:45,
 from
/home/cryolite/work/gcc-bugs/20150207/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/include/ccomplex:38,
 from
/home/cryolite/work/gcc-bugs/20150207/gcc-5-20150201/libstdc++-v3/include/precompiled/stdc++.h:52:
/home/cryolite/work/gcc-bugs/20150207/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/include/iosfwd:147:11:
error: ‘basic_stringbuf’ does not name a type
   typedef basic_stringbufchar  stringbuf;
   ^
/home/cryolite/work/gcc-bugs/20150207/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/include/iosfwd:150:11:
error: ‘basic_istringstream’ does not name a type
   typedef basic_istringstreamchar  istringstream;
   ^
/home/cryolite/work/gcc-bugs/20150207/objdir/x86_64-unknown-linux-gnu/libstdc++-v3/include/iosfwd:153:11:
error: ‘basic_ostringstream’ does not name a type
   typedef basic_ostringstreamchar  ostringstream;
   ^
(snip)

Bootstrap succeeds when `--enable-symvers=gnu-versioned-namespace' is unset.

[Bug c++/64106] New: [5 Regression][C++14] internal compiler error: in cxx_eval_store_expression

2014-11-28 Thread ai.azuma at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64106

Bug ID: 64106
   Summary: [5 Regression][C++14] internal compiler error: in
cxx_eval_store_expression
   Product: gcc
   Version: 5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ai.azuma at gmail dot com

Created attachment 34133
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=34133action=edit
Output of -v option and preprocessed file

The following code causes an ICE on 5.0.0 20141123 with -std=c++1y.

//==
void f(long c, int lc, char *out)
{
  while (lc = 8) *out++ = (c  (lc -= 8));
}
//==

The ICE message is internal compiler error: in cxx_eval_store_expression,
which is the same as one reported in PR64080, so I suspect that this bug report
could be a dup. However, the above reproducer looks very different than one in
PR64080, so I think this is worth being reported independently.

The above code successfully compiles on GCC 4.9.3 20141119 with -std=c++1y, so
it seems a regression. The reproducer originally comes from an OpenCV 2.4.10
source code.


[Bug sanitizer/63638] New: [4.9 Regression] internal compiler error: in asan_expand_check_ifn (with -fsanitize=address)

2014-10-24 Thread ai.azuma at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63638

Bug ID: 63638
   Summary: [4.9 Regression] internal compiler error: in
asan_expand_check_ifn (with -fsanitize=address)
   Product: gcc
   Version: 4.9.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ai.azuma at gmail dot com
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org

Created attachment 33802
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33802action=edit
Output of -v option and preprocessed file

The following code causes an ICE on GCC 4.9.2 20141022 with -fsanitize=address.

//
// string header is supposed to
// be required for memcpy, but
// there is an implicit built-in
// declaration.
//#includestring

struct S{
  long d0, d1, d2, d3, d4, d5, d6;
};

struct S s[6];

int f()
{
  struct S *p;
  memcpy(p, s[2], sizeof(*p));
  memcpy(p, s[1], sizeof(*p));
}
//

The above code successfully compiles on GCC 4.9.2 20141015 with
-fsanitize=address, so it seems a regression that has been introduced between
them. The reproducer originally comes from GMP 6.0.0a configure script.


[Bug libstdc++/62258] uncaught_exception() equals to `true' after rethrow_exception()

2014-10-07 Thread ai.azuma at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62258

Ai Azuma ai.azuma at gmail dot com changed:

   What|Removed |Added

 CC||ai.azuma at gmail dot com

--- Comment #4 from Ai Azuma ai.azuma at gmail dot com ---
PR61643 shares the root cause with this PR. The behavior of the test case in
PR61643 completely agrees with the analysis in Comment 2, and the proposed
patch makes the test case in PR61643 work properly.

I confirmed that this bug was reproduced with 4.8.4 20140925, 4.9.2 20140924
and 5.0.0 20140928.


[Bug libstdc++/61643] [C++11] std::uncaught_exception returns wrong values after std::rethrow_if_nested

2014-10-07 Thread ai.azuma at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61643

Ai Azuma ai.azuma at gmail dot com changed:

   What|Removed |Added

   Keywords||wrong-code
 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED
  Known to fail|4.10.0, 4.9.1   |4.9.2, 5.0

--- Comment #1 from Ai Azuma ai.azuma at gmail dot com ---
See Comment 2 in PR62258. The proposed patch attached in that comment make the
above test case work properly.


[Bug libstdc++/61643] [C++11] std::uncaught_exception returns wrong values after std::rethrow_if_nested

2014-10-07 Thread ai.azuma at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61643

Ai Azuma ai.azuma at gmail dot com changed:

   What|Removed |Added

 Resolution|FIXED   |DUPLICATE

--- Comment #2 from Ai Azuma ai.azuma at gmail dot com ---


*** This bug has been marked as a duplicate of bug 62258 ***


[Bug libstdc++/62258] uncaught_exception() equals to `true' after rethrow_exception()

2014-10-07 Thread ai.azuma at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62258

--- Comment #5 from Ai Azuma ai.azuma at gmail dot com ---
*** Bug 61643 has been marked as a duplicate of this bug. ***


[Bug c++/63454] [5 Regression] internal compiler error: canonical types differ for identical types

2014-10-06 Thread ai.azuma at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63454

--- Comment #3 from Ai Azuma ai.azuma at gmail dot com ---
(In reply to Daniel Krügler from comment #1)
 I don't see any ICE for gcc 5.0.0 20141004 (experimental). Could you retry
 that one?

I am still seeing the ICE with 5.0.0 20141005 (experimental).

[Bug c++/63454] New: [5 Regression] internal compiler error: canonical types differ for identical types

2014-10-03 Thread ai.azuma at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63454

Bug ID: 63454
   Summary: [5 Regression] internal compiler error: canonical
types differ for identical types
   Product: gcc
   Version: 5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ai.azuma at gmail dot com

Created attachment 33645
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33645action=edit
Output of -v option and preprocessed file

The following valid code causes an ICE with GCC 5.0.0 20140928.

//===
templatetypename T
struct A
{
  typedef T type;
};

templatetypename T
struct B
{};

templatetypename T
Btypename AT const::type
f(T const )
{}

templatetypename CharT
struct X
{
  typedef CharT char_type;

  void memfun()
  {
char_type const c[1] = { static_castchar_type(0) };
f(c);
  }
};

templatetypename CharT
struct Y
{
  typedef CharT char_type;

  void memfun()
  {
char_type const c[1] = { static_castchar_type(0) };
f(c);
  }
};

template struct Xchar;
template struct Ychar;
//===

Note that the above code compiles successfully with 4.9.2 20140924 and 4.8.4
20140925. The reproducer originally comes from a Boost.Log 1.56.0 source file.


[Bug c++/63430] New: [5 Regression] internal compiler error: Segmentation fault

2014-10-01 Thread ai.azuma at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63430

Bug ID: 63430
   Summary: [5 Regression] internal compiler error: Segmentation
fault
   Product: gcc
   Version: 5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ai.azuma at gmail dot com

Created attachment 33635
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33635action=edit
Output of -v option and preprocessed file

The following valid code causes segfault with GCC 5.0.0 20140928.

//==
extern int f(int *);

static int i __attribute__ ((__weakref__(f)));

templatetypename T
class X
{
  static __thread T* value_;
};
//==

Note that the above code compiles successfully with 4.9.2 20140924 and 4.8.4
20140925.


[Bug libstdc++/61643] New: [C++11] std::uncaught_exception returns wrong values after std::rethrow_if_nested

2014-06-28 Thread ai.azuma at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61643

Bug ID: 61643
   Summary: [C++11] std::uncaught_exception returns wrong values
after std::rethrow_if_nested
   Product: gcc
   Version: 4.10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ai.azuma at gmail dot com

The following program should terminate successfully.

//=
#include stdexcept
#include exception
#include cstdlib

struct X
{
  ~X() {
if (!std::uncaught_exception()) std::abort();// (A)
  }
};

int main() {
  try {
throw std::runtime_error();
  }
  catch (...) {
try {
  std::throw_with_nested(std::runtime_error());
}
catch (std::runtime_error const e) {
  try {
X x;
std::rethrow_if_nested(e);
  }
  catch (std::runtime_error const e) {
if (std::uncaught_exception()) std::abort(); // (B)
  }
}
  }
  return EXIT_SUCCESS;
}
//=

However, the program is aborted at the line marked with `(A)', and at the line
marked with `(B)' if the line marked with `(A)' is commented out.

This problem is reproduced with 4.10.0 20140622, 4.9.1 20140625 and 4.8.4
20140619. The reproducer requires -std=c++11 flag to compile.


[Bug libstdc++/59247] New: Bootstrap fails due to errors in libstdc++ sources with `--enable-symvers=gnu-versioned-namespace'

2013-11-21 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59247

Bug ID: 59247
   Summary: Bootstrap fails due to errors in libstdc++ sources
with `--enable-symvers=gnu-versioned-namespace'
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ai.azuma at gmail dot com

I have come across errors in stage 1 build of libstdc++ when trying to build
GCC 4.9-20131117 with the following commands on an x86_64-unknown-linux-gnu
machine:

  $ $SRCDIR/configure --enable-languages=c,c++
--enable-symvers=gnu-versioned-namespace
  $ make

Bootstrap succeeds when `--enable-symvers=gnu-versioned-namespace' is unset.

GCC 4.7-20131116 and 4.8-20131107 can be built successfully with the option,
thus this seems a regression.


[Bug libstdc++/58148] New: [C++11] Fails to insert iterator range into sequence container with -D_GLIBCXX_DEBUG when conversion is needed

2013-08-13 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58148

Bug ID: 58148
   Summary: [C++11] Fails to insert iterator range into sequence
container with -D_GLIBCXX_DEBUG when conversion is
needed
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ai.azuma at gmail dot com

Created attachment 30644
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=30644action=edit
reproducing source code and output of -v option

The following valid code fails to compile with 4.9.0 20130804 and
`-D_GLIBCXX_DEBUG':

//
#include vector

int main()
{
  std::vectorwchar_t v;
  char c = 'a';
  v.insert(v.begin(), c, c); // compile error
}
//

The above code successfully compiles with 4.9.0 20130728 and
`-D_GLIBCXX_DEBUG'. So this seems a regression, which has been introduced
between 20130728 and 20130804.

The same problem also occurs for `std::deque'.


[Bug c++/57470] New: Wrong line number in diagnostic message

2013-05-30 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57470

Bug ID: 57470
   Summary: Wrong line number in diagnostic message
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ai.azuma at gmail dot com

Created attachment 30225
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=30225action=edit
Output of -v option and preprocessed source with GCC 4.9.0 20130526

GCC 4.8.1 20130523 and 4.9.0 20130526 reject the following invalid code as
expected. However, the diagnostic message is not good.

//
templatetypename
struct Incomplete;

templatetypename T, T...
struct S
{
  static_assert(IncompleteT::value, );
};

Schar s;
//

For the above code, 4.9.0 20130526 says;

main.cpp: In instantiation of 'struct Schar':
main.cpp:10:9:   required from here
main.cpp:6:1: error: incomplete type 'Incompletechar' used in nested name
specifier
 {
 ^

GCC should point to line 7, not line 6. GCC 4.7.4 20130525 does not show a
caret but points to the wrong line number (line 6), too.


[Bug c++/57471] New: [C++11] Bizarre error for template parameter pack

2013-05-30 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57471

Bug ID: 57471
   Summary: [C++11] Bizarre error for template parameter pack
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ai.azuma at gmail dot com

Created attachment 30226
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=30226action=edit
Output of -v option and preprocessed source

GCC 4.9.0 20130526 rejects the following valid code.

//-
struct A
{
  static constexpr bool value = true;
};

templatetypename... Types
struct B
{
  static_assert(A::value, );
  static_assert(sizeof...(Types) == 0, );
};
//-

The error message is;

main.cpp:10:27: error: 'A::Types' has not been declared
   static_assert(sizeof...(Types) == 0, );
   ^

The above code successfully compiles with 4.7.4 20130525 and 4.8.1 20130523.


[Bug c++/56913] New: [C++11] SFINAE for ill-formed pointer-to-member operators with incompatible ref-qualifiers

2013-04-10 Thread ai.azuma at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56913



 Bug #: 56913

   Summary: [C++11] SFINAE for ill-formed pointer-to-member

operators with incompatible ref-qualifiers

Classification: Unclassified

   Product: gcc

   Version: 4.9.0

Status: UNCONFIRMED

  Severity: minor

  Priority: P3

 Component: c++

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: ai.az...@gmail.com





Created attachment 29851

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29851

Output of -v option and preprocessed source



GCC 4.8.1 20130404 and 4.9.0 20130407 reject the following well-formed code;



//---

templatetypename T

T declval();



templatetypename T, typename U,

 typename = decltype((declvalT().*declvalU())())

constexpr bool test(int)

{

  return true;

}



templatetypename T, typename U

constexpr bool test(...)

{

  return false;

}



struct S

{};



static_assert(!testS, void (S::*)() (0), );

static_assert(testS, void (S::*)() (0), );

static_assert(testS , void (S::*)() (0), );

static_assert(!testS , void (S::*)() (0), );

//---



For the above code, GCC 4.9.0 20130407 complains as follows;



main.cpp:5:43: error: pointer-to-member-function type 'void (S::*)() '

requires an lvalue

  typename = decltype((declvalT().*declvalU())())

   ^

main.cpp:20:1: error: static assertion failed: 

 static_assert(!testS, void (S::*)() (0), );

 ^

main.cpp:5:43: error: pointer-to-member-function type 'void (S::*)() '

requires an rvalue

  typename = decltype((declvalT().*declvalU())())

   ^

main.cpp:23:1: error: static assertion failed: 

 static_assert(!testS , void (S::*)() (0), );

 ^



SFINAE does not seem to be applied to ill-formed pointer-to-member operators

(as per N3485 [expr.mptr.oper]/6) instantiated in the first and fourth

static_asserts, and they result in hard errors.


[Bug libstdc++/56834] New: Errors in array with --enable-symvers=gnu-versioned-namespace and -D_GLIBCXX_DEBUG

2013-04-03 Thread ai.azuma at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56834



 Bug #: 56834

   Summary: Errors in array with

--enable-symvers=gnu-versioned-namespace and

-D_GLIBCXX_DEBUG

Classification: Unclassified

   Product: gcc

   Version: 4.9.0

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: libstdc++

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: ai.az...@gmail.com





Created attachment 29794

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29794

Output of -v option



The following simple code compiling with -std=c++11 and -D_GLIBCXX_DEBUG is

rejected by GCC 4.9.0 20130331 configured with

--enable-symvers=gnu-versioned-namespace.



//--

#include array

//--



The issue is not reproduced when either

--enable-symvers=gnu-versioned-namespace (in GCC configure option) or

-D_GLIBCXX_DEBUG (in compile option) is unset.


[Bug libstdc++/56557] New: Link error about `std::fstream' or `std::stringstream' with `-flto' and `-rdynamic' options

2013-03-06 Thread ai.azuma at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56557



 Bug #: 56557

   Summary: Link error about `std::fstream' or `std::stringstream'

with `-flto' and `-rdynamic' options

Classification: Unclassified

   Product: gcc

   Version: 4.8.0

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: libstdc++

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: ai.az...@gmail.com





Created attachment 29605

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29605

Output of -v option



The following code results in a link error when compiling on GCC 4.8.0 20130303

with `-flto' and `-rdynamic' options;



//

#include fstream



int main()

{

  std::fstream x;

}

//



The link error is;



cryolite@ubuntu:~/work/gcc-bugs/20130306$ ~/local/gcc-4.8-20130303/bin/g++

-flto -rdynamic main.cpp

/usr/bin/ld: a.out: hidden symbol

`_ZTCSt13basic_fstreamIcSt11char_traitsIcEE0_Sd' isn't defined

/usr/bin/ld: final link failed: Bad value

collect2: error: ld returned 1 exit status



Other specializations of `std::basic_fstream' or `std::basic_stringstream' have

the similar issue.



As far as I can confirm, this problem is not reproduced with 4.6.4 20130301 or

4.7.3 20130302. Thus, this seems a regression.


[Bug libstdc++/55861] New: [C++11] `std::shared_future::get' is not const-qualified

2013-01-03 Thread ai.azuma at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55861



 Bug #: 55861

   Summary: [C++11] `std::shared_future::get' is not

const-qualified

Classification: Unclassified

   Product: gcc

   Version: 4.8.0

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: libstdc++

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: ai.az...@gmail.com





`std::shared_futureR::get' member function is specified as const-qualified in

[futures.shared_future]. However, libstdc++'s implementation is not. A testcase

would be as follows;



//--

#include future



int f()

{

  return 42;

}



int main()

{

  std::shared_futureint const ftr(std::async(f));

  ftr.get(); // Line 11

}

//--



For the above testcase, GCC 4.8.0 20121230 complains as follows;



main.cpp: In function 'int main()':

main.cpp:11:11: error: passing 'const std::shared_futureint' as 'this'

argument of 'const _Res std::shared_future_Res::get() [with _Res = int]'

discards qualifiers [-fpermissive]

   ftr.get();

   ^


[Bug lto/55848] New: internal compiler error: verify_cgraph_node failed (with `-flto' and `-fopenmp')

2013-01-02 Thread ai.azuma at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55848



 Bug #: 55848

   Summary: internal compiler error: verify_cgraph_node failed

(with `-flto' and `-fopenmp')

Classification: Unclassified

   Product: gcc

   Version: 4.8.0

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: lto

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: ai.az...@gmail.com





Created attachment 29073

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29073

Output of -v option and preprocessed file



The following C++ source code results in an ICE when compiling on GCC 4.8.0

20121230 with `-flto' and `-fopenmp' command-line options.



//

typedef long unsigned int size_t;



extern C {

  extern int omp_get_thread_num (void) throw ();

}



extern C {

  extern int snprintf(char *__restrict __s, size_t __maxlen, const char

*__restrict __format, ...) throw ()

  __attribute__ ((__format__ (__printf__, 3, 4)));

}



void f()

{

  char msg[1024] = ;

  snprintf( msg, sizeof(msg)-1, [%d] , omp_get_thread_num() );

}



void g()

{

#pragma omp parallel for

  for( int i = 0; i  0; i += 1 ) {

f();

  }

}

//



Note that the ICE is not reproduced with GCC 4.6.4 20121228 or 4.7.3 20121229.


[Bug sanitizer/55799] New: AddressSanitizer with `-pg' option results in spurious errors

2012-12-23 Thread ai.azuma at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55799



 Bug #: 55799

   Summary: AddressSanitizer with `-pg' option results in spurious

errors

Classification: Unclassified

   Product: gcc

   Version: 4.8.0

Status: UNCONFIRMED

  Severity: enhancement

  Priority: P3

 Component: sanitizer

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: ai.az...@gmail.com

CC: do...@gcc.gnu.org, dvyu...@gcc.gnu.org,

ja...@gcc.gnu.org, k...@gcc.gnu.org





Created attachment 29036

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29036

Command-line log



The following simple program



//-

int main()

{

  return 0;

}

//-



results in spurious errors when compiled with `-fsanitize=address' and `-pg'.



$ gcc -pg -fsanitize=address main.cpp



$ ./a.out

=

==829== ERROR: AddressSanitizer: attempting free on address which was not

malloc()-ed: 0x7f1e242d55a0

#0 0x7f1e21ebfa4e

(/home/cryolite/local/gcc-snapshot/lib64/libasan.so.0.0.0+0xfa4e)

#1 0x327f235db1 (/lib64/libc-2.12.so+0x35db1)

Stats: 0M malloced (0M for red zones) by 0 calls

Stats: 0M realloced by 0 calls

Stats: 0M freed by 0 calls

Stats: 0M really freed by 0 calls

Stats: 0M (0 full pages) mmaped in 0 calls

  mmaps   by size class:

  mallocs by size class:

  frees   by size class:

  rfrees  by size class:

Stats: malloc large: 0 small slow: 0

==829== ABORTING


[Bug c++/55526] New: [C++11] Irrelevant error message for function parameter wrongly used in noexcept specifier

2012-11-28 Thread ai.azuma at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55526



 Bug #: 55526

   Summary: [C++11] Irrelevant error message for function

parameter wrongly used in noexcept specifier

Classification: Unclassified

   Product: gcc

   Version: 4.8.0

Status: UNCONFIRMED

  Severity: minor

  Priority: P3

 Component: c++

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: ai.az...@gmail.com





The following code is rejected as expected.



//---

void f(int i) noexcept(i)

{}

//---



However, the diagnostic message points out an irrelevant origin of the error.



main.cpp:1:24: error: use of parameter 'i' outside function body

 void f(int i) noexcept(i)

^



The use of parameter 'i' itself is legal at this point because 'i' is visible.

The real issue is to use a non-constant expression as the argument to noexcept

specifier. So, it would be better to output an error message like the

following, as does clang++.



main.cpp:1:24: error: argument to noexcept specifier must be a constant

expression

void f(int i) noexcept(i)

   ^


[Bug c++/55335] New: [DR 5] cv-qualifiers of destination type in copy-initialization

2012-11-14 Thread ai.azuma at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55335



 Bug #: 55335

   Summary: [DR 5] cv-qualifiers of destination type in

copy-initialization

Classification: Unclassified

   Product: gcc

   Version: 4.8.0

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: c++

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: ai.az...@gmail.com





Created attachment 28694

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=28694

Output of -v option and preprocessed file with GCC 4.8.0 2012



The following valid code is rejected by GCC 4.6.4 20121109, 4.7.3 20121110 and

4.8.0 2012.



/

struct C{};



struct A {

  A(const A){};

  A(const C){};

};



int main()

{

  C c;

  const volatile A a = c;

}

/



For the above code, GCC 4.8.0 2012 complains as follows;



main.cpp: In function 'int main()':

main.cpp:11:24: error: no matching function for call to 'A::A(const volatile

A)'

   const volatile A a = c;

^

main.cpp:11:24: note: candidates are:

main.cpp:5:3: note: A::A(const C)

   A(const C){};

   ^

main.cpp:5:3: note:   no known conversion for argument 1 from 'const volatile

A' to 'const C'

main.cpp:4:3: note: A::A(const A)

   A(const A){};

   ^

main.cpp:4:3: note:   no known conversion for argument 1 from 'const volatile

A' to 'const A'



As far as I can guess from the error message, GCC does not seem to implement

the proposed resolution of DR 5.

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#5


[Bug c++/54975] New: [C++11] cv-qualifiers of typedef-name are ignored in lambda expression

2012-10-18 Thread ai.azuma at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54975



 Bug #: 54975

   Summary: [C++11] cv-qualifiers of typedef-name are ignored in

lambda expression

Classification: Unclassified

   Product: gcc

   Version: 4.8.0

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: c++

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: ai.az...@gmail.com





Created attachment 28485

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=28485

Output of -v option and preprocessed file with GCC 4.8.0 20121014



The following valid code reproduces the problem;



/

templatetypename T

struct identity

{

  typedef T type;

};



templatetypename T

void f()

{

  typedef typename T::type A;

  int i = 42;

  int const cri = i;

  int volatile vri = i;

  []() {

A const x = cri;// Problem here

A volatile y = vri; // Likewise

  };

}



int main()

{

  fidentityint ();

}

/



In the lambda-expression, initilizations of cv-qualified references are

obviously legal. However, GCC 4.8.0 20121014 complains as follows;



main.cpp: In instantiation of 'f() [with T = identityint]::__lambda0':

main.cpp:16:21:   required from 'struct f() [with T =

identityint]::__lambda0'

main.cpp:14:3:   required from 'void f() [with T = identityint]'

main.cpp:22:21:   required from here

main.cpp:15:18: error: invalid initialization of reference of type

'identityint::type {aka int}' from expression of type 'const int'

 A const x = cri;

  ^

main.cpp:16:21: error: invalid initialization of reference of type

'identityint::type {aka int}' from expression of type 'volatile int'

 A volatile y = vri;

 ^



The error messages look as if there were no cv-qualifiers in the declarators.



Note that GCC 4.7.3 20121013 also fails to compile, but GCC 4.6.4 20121012

compiles successfully.


[Bug c++/54891] New: [C++11] lambda-expression and explicit type conversion (cast notation)

2012-10-10 Thread ai.azuma at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54891



 Bug #: 54891

   Summary: [C++11] lambda-expression and explicit type conversion

(cast notation)

Classification: Unclassified

   Product: gcc

   Version: 4.8.0

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: c++

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: ai.az...@gmail.com





Created attachment 28413

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=28413

Output of -v option and preprocessed file



The following valid code is rejected by GCC 4.8.0 20121007, 4.7.3 20121006 and

4.6.4 20121005.



/

int main()

{

  (void)[]{};

}

/



For the above code, GCC 4.8.0 20121007 says;



main.cpp: In function 'int main()':

main.cpp:3:4: error: expected primary-expression before 'void'

   (void)[]{};

^

main.cpp:3:4: error: expected ')' before 'void'


[Bug c++/54744] New: internal compiler error: Segmentation fault, by dependent base, member typedef and ctor-initializer

2012-09-29 Thread ai.azuma at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54744



 Bug #: 54744

   Summary: internal compiler error: Segmentation fault, by

dependent base, member typedef and ctor-initializer

Classification: Unclassified

   Product: gcc

   Version: 4.8.0

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: c++

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: ai.az...@gmail.com





Created attachment 28298

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=28298

Output of -v option and preprocessed file



The following valid code causes segfault with GCC 4.8.0 20120916 and GCC 4.7.3

20120922.



///

template typename T

struct base {

  typedef base base_type;

};



template typename T

struct derived : baseT {

  typedef typename derived::base_type::base_type base_type;

  derived() : base_type() {}

};

///



Note that the above code compiles successfully with GCC 4.6.4 20120921.


[Bug libstdc++/54297] New: [C++11] Segmentation fault with std::async and released shared state

2012-08-17 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54297

 Bug #: 54297
   Summary: [C++11] Segmentation fault with std::async and
released shared state
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


Created attachment 28043
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=28043
Command-line log

The following code causes segfault with GCC 4.8.0 20120812, -std=c++11 and
-pthread.

/
#include chrono
#include thread
#include future

int work()
{
  std::this_thread::sleep_for(std::chrono::seconds(1));
  return 0;
}

int main()
{
  // Note that the following explicitly named future object
  // is not necessary to reproduce the problem.
  std::futureint f = std::async(std::launch::async, work);
}
/

The last invocation of std::futureint's destructor blocks the calling thread
until the thread launched by std::async finishes the work, according to the 4th
bullet of [futures.async]/5. Therefore, this program should terminate
successfully.

This program also results in segfault with GCC 4.7.2 20120811, but not with
4.6.4 20120810.


[Bug c++/54191] New: [C++11] SFINAE does not handle conversion to inaccessible base

2012-08-07 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54191

 Bug #: 54191
   Summary: [C++11] SFINAE does not handle conversion to
inaccessible base
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


The attached code includes some test cases for SFINAE on expressions
necessitating conversion from (a pointer to) an object of a derived class to (a
pointer to) an object of an inaccessible base class, or inverse of such
conversion. All the static_asserts in the attached code should be well-formed
according to the specification, but fail with GCC 4.8.0 20120805.

I think this PR is closely related to PR51213.


[Bug c++/54191] [C++11] SFINAE does not handle conversion to inaccessible base

2012-08-07 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54191

--- Comment #1 from Ai Azuma ai.azuma at gmail dot com 2012-08-07 11:19:03 
UTC ---
Created attachment 27955
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27955
Some test cases for SFINAE on conversion to inaccessible base


[Bug c++/54191] [C++11] SFINAE does not handle conversion to inaccessible base

2012-08-07 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54191

--- Comment #2 from Ai Azuma ai.azuma at gmail dot com 2012-08-07 11:21:36 
UTC ---
Created attachment 27956
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27956
Output of -v option


[Bug c++/54158] [4.6, 4.7, 4.8 Regression] Silently accepts sizeof to non-static member without object in C++03 mode

2012-08-03 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54158

--- Comment #7 from Ai Azuma ai.azuma at gmail dot com 2012-08-03 08:21:21 
UTC ---
(In reply to comment #6)
 Right

O.K. Then, this behavior makes sense. Thanks for the clarification!


[Bug c++/54158] [4.6, 4.7, 4.8 Regression] Silently accepts sizeof to non-static member without object in C++03 mode

2012-08-02 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54158

--- Comment #5 from Ai Azuma ai.azuma at gmail dot com 2012-08-03 02:05:45 
UTC ---
Well, I'm a bit confused. So I would like to make sure some points.

 Ah, it was changed by a DR
 (http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#613) not a C++11
 proposal, so supporting it in C++03 mode is probably intentional.

The proposed resolution for DRs on 03's wording with Status: CD1 is not
considered as a part of C++11, right?

And GCC's `-std=c++03' intentionally includes such proposed resolutions, right?


[Bug c++/54158] New: Silently accepts sizeof to non-static member without object in C++03 mode

2012-08-01 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54158

 Bug #: 54158
   Summary: Silently accepts sizeof to non-static member without
object in C++03 mode
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


The following code is not well-formed in C++03.

/
struct Class
{
  int Member;
};

int i[sizeof(Class::Member)];
/

However, GCC 4.6.4 20120727, 4.7.2 20120728 and 4.8.0 20120729 accept this code
without any warning, even with `-std=c++03', `-Wall' and `-pedantic'.


[Bug c++/53954] [C++11] Undefined reference to non-odr-used static const member variable of variadic class template in DSO with -flto and -Wl,--export-dynamic

2012-07-18 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53954

Ai Azuma ai.azuma at gmail dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||INVALID

--- Comment #5 from Ai Azuma ai.azuma at gmail dot com 2012-07-19 03:12:21 
UTC ---
Hmm, now I have arrived at the conclusion that non-odr-used variables might
require the definition, depending on compiler options etc., and this PR is
invalid, since there is no guarantee in the specification that
non-odr-used-ness of variables makes the definition unnecessary.

I'm sorry. I created this PR based on the wrong assumption. I should have
created a PR reporting the bug in libstdc++. And thank you for the quick fixes.

Again, thank you for your time.


[Bug c++/53954] New: [C++11] Undefined reference to non-odr-used static const member variable of variadic class template in DSO with -flto and -Wl,--export-dynamic

2012-07-13 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53954

 Bug #: 53954
   Summary: [C++11] Undefined reference to non-odr-used static
const member variable of variadic class template in
DSO with -flto and -Wl,--export-dynamic
Classification: Unclassified
   Product: gcc
   Version: 4.7.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


Created attachment 27785
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27785
Command-line log

The following code shows the problem with GCC 4.7.2 20120707 on
x86_64-unknown-linux-gnu.

//
// foo.cpp
templatetypename...
struct S
{
  static const bool value = false;
};

void f() {
  typedef decltype(S::value) B;
}
//

Obviously, `S::value' is not odr-used. Therefore, the program should not
require its definition. However, when a DSO is created from the above code with
GCC 4.7.2 20120707, `-flto' and `-Wl,--export-dynamic' options, it requires the
definition of `S::value'.

For example, the following command lines result in a link error.

$ g++ -std=c++11 -fPIC -flto -Wl,--export-dynamic -o libfoo.so -shared foo.cpp

$ g++ -std=c++11 -fPIC main.cpp -L. -lfoo
./libfoo.so: undefined reference to `S::value'
./libfoo.so: undefined reference to `S::value'
collect2: error: ld returned 1 exit status

where main.cpp is a trivial C++ source file like int main(){}.

Note that neither GCC 4.6.4 20120706 nor 4.8.0 20120708 reproduces the problem.

Note also that the above reproducer originally comes from a likely C++ code
using `std::vector' and `-std=c++11' option, like the following;

/
#include vector

void f()
{
  std::vectorint v;
  v.push_back(0);
}
/

When a DSO is created from this code with `-std=c++11', `-lfto' and
`-Wl,--export-dynamic' options, it requires the definition of
`std::allocator_traitsstd::allocatorint ::__construct_helperint,
int::value'.


[Bug c++/53816] New: internal compiler error: tree check: expected field_decl, have identifier_node in fixed_type_or_null, at cp/class.c:6419, with -std=c++11 option

2012-06-30 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53816

 Bug #: 53816
   Summary: internal compiler error: tree check: expected
field_decl, have identifier_node in
fixed_type_or_null, at cp/class.c:6419, with
-std=c++11 option
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


Created attachment 27721
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27721
preprocessed source file

The attached code looks innocent but causes ICE with GCC 4.8.0 20120624
(experimental) and `-std=c++11' option, although it doesn't rely on any C++11
feature. And without `-std=c++11' option, it successfully compiles.

Note that the attached code successfully compiles with GCC 4.6.4 20120622
(prerelease) and 4.7.2 20120623 (prerelease), regardless of whether
`-std=c++0x' option is used.


[Bug c++/53816] internal compiler error: tree check: expected field_decl, have identifier_node in fixed_type_or_null, at cp/class.c:6419, with -std=c++11 option

2012-06-30 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53816

--- Comment #1 from Ai Azuma ai.azuma at gmail dot com 2012-06-30 06:34:40 
UTC ---
Created attachment 27722
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27722
Output of -v option


[Bug c++/53488] Incorrect code generated when capturing a constant by reference in a lambda

2012-06-25 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53488

Ai Azuma ai.azuma at gmail dot com changed:

   What|Removed |Added

 CC||ai.azuma at gmail dot com

--- Comment #9 from Ai Azuma ai.azuma at gmail dot com 2012-06-25 14:28:00 
UTC ---
I don't know if that helps, but there exists a bug report similar to one
reported in Comment 0.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50939


[Bug c++/53401] New: internal compiler error: Segmentation fault on infinite argument deduction of constexpr templates

2012-05-18 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53401

 Bug #: 53401
   Summary: internal compiler error: Segmentation fault on
infinite argument deduction of constexpr templates
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


Created attachment 27434
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27434
Outputs from -v option (repeated error messages are snipped) and preprocessed
source.

The following invalid code causes an ICE with GCC 4.8.0 20120513 (experimental)
and -std=c++11.


/
templateint I
struct index
{};

constexpr int recursive_impl(index0u)
{
  return 0;
}

templateint N
constexpr auto recursive_impl(indexN)   // Line 11
  - decltype(recursive_impl(indexN - 1()))
{
  return recursive_impl(indexN - 1());
}

templateint N
constexpr auto recursive()
  - decltype(recursive_impl(indexN()))
{
  return recursive_impl(indexN());
}

void f(int i)
{
  recursive1();
}
/

g++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.


The above-mentioned code is invalid because there isn't anything to prevent the
compiler from trying infinite template argument deduction in the second
overload of `recursive_impl' (Line 11). So, I expect error messages like
template instantiation depth exceeds maximum However, the compiler dies
in segmentation fault.

`constexpr' is necessary to reproduce the ICE. Otherwise, the compiler outputs
ordinary error messages as expected.

4.6.4 20120511 (prerelease) and 4.7.1 20120512 (prerelease) also cause the same
problem, too.


[Bug c++/53402] New: [C++11] non-inline namespace can be wrongly re-opened as inline

2012-05-18 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53402

 Bug #: 53402
   Summary: [C++11] non-inline namespace can be wrongly re-opened
as inline
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


C++11 7.3.1/7 says,

If the optional initial inline keyword appears in a namespace-definition for a
particular namespace, that namespace is declared to be an inline namespace. The
inline keyword may be used on an extension-namespace-definition only if it was
previously used on the original-namespace-definition for that namespace.

I understand that this paragraph prohibits retroactive inlining of
namespaces, like the following code;

/
namespace NS{}
inline namespace NS{}
/

However, GCC 4.8.0 20120513 (experimental) with -std=c++11, -Wall and
-Wpedantic accepts the above code without any warning.

In addition, the document that explains the implementation of libstdc++ debug
mode
http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt03ch17s04.html#debug_mode.design.methods.coexistence
includes an example code using retroactive inlining. It may mislead some
readers to think that this is standard-conforming. Therefore, even if the
current implementation of libstdc++ debug mode uses retroactive inlining, it's
better to avoid this style in the document.


[Bug c/52977] New: internal compiler error: Segmentation fault with `-x c-header' or `-x cxx-header' option

2012-04-13 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52977

 Bug #: 52977
   Summary: internal compiler error: Segmentation fault with `-x
c-header' or `-x cxx-header' option
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


Created attachment 27152
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27152
Output of -v option and preprocessed file

The following code causes an ICE with GCC 4.8.0 20120408 (experimental) and `-x
c-header' or `-x cxx-header' option.



typedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__));
__inline __m64 __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
_mm_setzero_si64() { return (__m64)0LL; }



N.B. As far as I can confirm, this ICE is not reproduced with GCC 4.6.3, GCC
4.7.0 and GCC 4.8.0 20120311. This reproducer originally comes from a
Boost.Math 1.49.0 source file.


[Bug c++/52613] New: [C++11] ICE with noexcept in lambda expression in member function of class template

2012-03-19 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52613

 Bug #: 52613
   Summary: [C++11] ICE with noexcept in lambda expression in
member function of class template
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


Created attachment 26914
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26914
Output of -v option and preprocessed file

The following valid code causes an ICE.

///
templatetypename
struct S
{
  void f()
  {
[] { noexcept(!b_); };
  }
  bool b_;
};
///

main.cpp: In lambda function:
main.cpp:6:21: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.


[Bug c++/52440] New: [C++11] Wrong template argument deduction/substitution failures

2012-02-29 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52440

 Bug #: 52440
   Summary: [C++11] Wrong template argument deduction/substitution
failures
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


Created attachment 26790
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26790
Output of -v option and preprocessed file

I can't find anything to prevent the following code from compiling;

/
templatebool
struct V
{
  typedef void type;
};

templatetypename T
struct X
{
  templatetypename
  static constexpr bool always_true()
  {
return true;
  };

  templatetypename U,
   typename = typename Valways_trueU()::type
  X(U ) {}// Line 18
};

int main()
{
  Xint x(42); // Line 23
}
/

However, GCC complains about deduction/substitution failure;

main.cpp: In function 'int main()':
main.cpp:23:14: error: no matching function for call to 'Xint::X(int)'
main.cpp:23:14: note: candidates are:
main.cpp:18:3: note: templateclass U, class X::X(U)
main.cpp:18:3: note:   template argument deduction/substitution failed:
main.cpp:8:8: note: constexpr Xint::X(const Xint)
main.cpp:8:8: note:   no known conversion for argument 1 from 'int' to 'const
Xint'
main.cpp:8:8: note: constexpr Xint::X(Xint)
main.cpp:8:8: note:   no known conversion for argument 1 from 'int' to
'Xint'

The constructor template in line 18 should always succeed in template argument
deduction/substitution and be used for the invocation in Line 23.

My guess is that this is a bug of GCC.


[Bug c++/52380] New: [C++11] Number of variadic template arguments wrongly interpreted in class template

2012-02-25 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52380

 Bug #: 52380
   Summary: [C++11] Number of variadic template arguments wrongly
interpreted in class template
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


Created attachment 26752
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26752
Output of -v option and preprocessed file

Here is a reproducer;

///
// An enclosing class template is necessary to
// reproduce the bug.
templatetypename T
struct S
{
  templatetypename U
  struct Unary// Line 5
  {};

  templateunsigned, typename... Args
  struct Dispatch // Line 9
: public UnaryArgs...
  {};

  templatetypename... Args
  struct Variadic
: public Dispatchsizeof...(Args), Args...
  {};
};

int main()
{
  Svoid::Variadicvoid z;
}
///

GCC 4.7.0 20120218 (experimental) with -std=c++11 complains about the above
code;

main.cpp: In instantiation of 'struct Svoid::Dispatch1u, void':
main.cpp:14:10:   required from 'struct Svoid::Variadicvoid'
main.cpp:21:27:   required from here
main.cpp:9:10: error: wrong number of template arguments (2, should be 1)
main.cpp:5:10: error: provided for 'templateclass T templateclass U struct
ST::Unary'

Obviously, just one template argument is passed to `Unary'. However, GCC
misinterprets the number of template arguments as two.


[Bug c++/52369] New: Const-qualified non-class base member and defaulted default constructor

2012-02-24 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52369

 Bug #: 52369
   Summary: Const-qualified non-class base member and defaulted
default constructor
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


Created attachment 26740
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26740
Output of -v option and preprocessed file

The following ill-formed code is wrongly accepted by GCC 4.7.0 20120218
(experimental).


class B
{
private:
  int const v_;
};

class D
  : public B
{};

int main()
{
  D d;
}


B's default constructor is implicitly-declared and has no ctor-initializer. So,
B::v_ is not designated by any mem-initializer-id and subject to
default-initialization. However, default-initialization of a const-qualified
non-class type is ill-formed. Therefore, the use of B's constructor is
ill-formed (and it should be defined as deleted in -std=c++11 mode), and the
use of D's is also ill-formed.

N.B. A similar (but a bit different) problem seems to have been resolved in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29043 .


[Bug c++/52371] New: [C++11] ICE in noexcept with constexpr conversion function

2012-02-24 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52371

 Bug #: 52371
   Summary: [C++11] ICE in noexcept with constexpr conversion
function
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


The following well-formed code causes ICE on GCC 4.7.0 20120218 (experimental).

//
templatetypename T, T v
struct integral_constant
{
  typedef T value_type;
  static constexpr value_type value = v;
  constexpr operator value_type() { return value; }
};

templatetypename T
struct B
{
  B()
  noexcept(integral_constantbool, noexcept(T())()) // - ICE
: v_()
  {}

  T v_;
};

int main()
{
  Bint b;
}
//

If I use the static constexpr `value' instread of the constexpr conversion
function, the ICE disappears.


[Bug c++/52371] [C++11] ICE in noexcept with constexpr conversion function

2012-02-24 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52371

--- Comment #1 from Ai Azuma ai.azuma at gmail dot com 2012-02-24 13:54:18 
UTC ---
Created attachment 26741
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26741
Output of -v option and preprocessed file


[Bug c++/52371] [C++11] ICE in noexcept with constexpr conversion function

2012-02-24 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52371

--- Comment #2 from Ai Azuma ai.azuma at gmail dot com 2012-02-24 14:01:41 
UTC ---
I'm sorry. I forgot to write that this ICE appears with -std=c++11 option.


[Bug c++/52374] New: [C++11] Fails to transform id-expression into dependent base member access in lambda expression

2012-02-24 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52374

 Bug #: 52374
   Summary: [C++11] Fails to transform id-expression into
dependent base member access in lambda expression
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


Created attachment 26742
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26742
Output of -v option and preprocessed file

In the lambda expression's compound statement, id-expressions referring to
non-static members should be transformed into class member access expressions
by prefixing `(*this).'. However, GCC fails the transformation when
id-expressions involved are qualified-ids and refer to dependent base members.

A test case is as follows;


struct B
{
  int get() const { return 42; }
};

templatetypename X
struct D
  : public X
{
  int get() const { return [this]() - int { return X::get(); }(); }
};

int main()
{
  DB d;
  d.get();
}



For the above mentioned well-formed code, 4.7.0 20120218 (experimental) with
-std=c++11 complains as follows;

main.cpp: In instantiation of 'DX::get() const [with X = B]::lambda()':
main.cpp:10:29:   required from 'struct DX::get() const [with X =
B]::lambda()'
main.cpp:10:65:   required from 'int DX::get() const [with X = B]'
main.cpp:16:9:   required from here
main.cpp:10:60: error: cannot call member function 'int B::get() const' without
object

`X::get' in the lambda expression should be implicitly transformed into
`(*this).X::get', and the test case should compile successfully.


[Bug c++/52269] New: [C++11]Body of constexpr function templates instantiated too eagerly in unevaluated operands

2012-02-15 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52269

 Bug #: 52269
   Summary: [C++11]Body of constexpr function templates
instantiated too eagerly in unevaluated operands
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


The following well-formed code cannot be compiled with GCC 4.7.0 20120211
(experimental) and -std=c++11 flag.


templatetypename T
int f(T x)
{
  return x.get();
}

// O.K. The body of `f' is not required.
decltype(f(0)) a;

templatetypename T
constexpr int g(T x)
{
  return x.get();
}

// Seems to instantiate the body of `g'
// and results in an error.
decltype(g(0)) b;


Similar problems also arise in the case of non-template member functions of a
class template.


[Bug c++/51253] New: [C++11][DR 1030] Evaluation order (sequenced-before relation) among intializer-clauses in braced-init-list

2011-11-20 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51253

 Bug #: 51253
   Summary: [C++11][DR 1030] Evaluation order (sequenced-before
relation) among intializer-clauses in braced-init-list
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


Since DR 1030 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1030
was accepted, I expect that the following code is well-defined and exits with
the status code 0. However, GCC 4.7.0 2012 (experimental) with -std=c++11
produces a wrong executable. In addition, it spuriously warns about undefined
operations with -Wsequence-point option.

//
struct swallow{
  templatetypename... Types
  swallow(Types ...){}
};

templateint... IS
int f()
{
  int i = 2;
  swallow{ i = i * IS + IS... };
  return i;
}

int main()
{
  // `i = i * 2 + 2' should be sequenced before `i = i * 3 + 3'
  return f2, 3() == 21 ? 0 : 1;
}
//


[Bug c++/51161] New: [C++0x] Illegal static_cast to rvalue reference to ambiguous base class

2011-11-16 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51161

 Bug #: 51161
   Summary: [C++0x] Illegal static_cast to rvalue reference to
ambiguous base class
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


Created attachment 25838
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=25838
Outputs from -v option and preprocessed source.

According to N3291 (5.2.9/3), the following code is ill-formed. However, GCC
4.7-2012 with -std=c++11 accepts it.


///
struct A{};
struct B : A{};
struct C : A{};
struct D : B, C{};

int main()
{
  D d;
  static_castA (d);
}
///


[Bug c++/51184] New: Abstract class in function return type

2011-11-16 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51184

 Bug #: 51184
   Summary: Abstract class in function return type
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


Created attachment 25842
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=25842
Outputs by -v option and preprocessed source.

An abstract class shall not be used as a function return type. However, GCC
4.7-2012 accepts the following code.


///
templatetypename T
struct S{};

struct A
{
  virtual void f() = 0;
};

int main()
{
  SA(int) s;
}
///


[Bug libstdc++/51185] New: [C++0x] false-positive results of std::is_constructible

2011-11-16 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51185

 Bug #: 51185
   Summary: [C++0x] false-positive results of
std::is_constructible
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: libstdc++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


All of the static_asserts in the following code result in compile error with
-std=c++11.



#include type_traits

struct A{};
struct B : A{};

int main()
{
  static_assert(!std::is_constructibleB , A(), );
  static_assert(!std::is_constructibleB const , A(), );
  static_assert(!std::is_constructibleB const , A const(), );
  static_assert(!std::is_constructibleB volatile , A(), );
  static_assert(!std::is_constructibleB volatile , A volatile(), );
  static_assert(!std::is_constructibleB const volatile , A(), );
  static_assert(!std::is_constructibleB const volatile , A const(), );
  static_assert(!std::is_constructibleB const volatile , A volatile(), );
  static_assert(!std::is_constructibleB const volatile , A const
volatile(), );
}



[Bug c++/51148] New: [C++0x] Unexpanded template param packs wrongly accepted in friend class declarations

2011-11-15 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51148

 Bug #: 51148
   Summary: [C++0x] Unexpanded template param packs wrongly
accepted in friend class declarations
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


Created attachment 25831
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=25831
Outputs by -v option and preprocessed source.

GCC 4.7-2012 with -std=c++11 wrongly accepts the following ill-formed code.

===
templatetypename... Types
struct S
{};

templatetypename... Types
struct T
{
  friend class STypes;
};

int main()
{}
===


[Bug c++/51046] New: ICE by unexpanded template param pack in range-based for

2011-11-08 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51046

 Bug #: 51046
   Summary: ICE by unexpanded template param pack in range-based
for
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


The following ill-formed code results in ICE.


cryolite@blueplanet:~/work/test$ LANG=C
/home/cryolite/local/4.7.0/bin/g++-tlimit -v -save-temps -std=c++0x main.cpp
Using built-in specs.
COLLECT_GCC=/home/cryolite/local/4.7.0/bin/g++
COLLECT_LTO_WRAPPER=/home/cryolite/local/4.7.0/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/cryolite/work/intro/gcc-4.7-2005/configure
--build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu
--target=x86_64-unknown-linux-gnu --prefix=/home/cryolite/local/4.7.0
--enable-static --enable-shared --enable-multilib --enable-threads=posix
--enable-tls --with-arch-32=i686 --with-tune=generic --enable-bootstrap
--enable-languages=c,c++ --enable-libssp --enable-libgomp --enable-targets=all
--enable-nls --enable-lto --enable-libstdcxx-debug --disable-libstdcxx-pch
Thread model: posix
gcc version 4.7.0 2005 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /home/cryolite/local/4.7.0/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/cc1plus
-E -quiet -v -D_GNU_SOURCE main.cpp -mtune=generic -march=x86-64 -std=c++11
-fpch-preprocess -o main.ii
ignoring nonexistent directory
/home/cryolite/local/4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../x86_64-unknown-linux-gnu/include
#include ... search starts here:
#include ... search starts here:

/home/cryolite/local/4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0

/home/cryolite/local/4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/x86_64-unknown-linux-gnu

/home/cryolite/local/4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/backward
 /home/cryolite/local/4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/include
 /usr/local/include
 /home/cryolite/local/4.7.0/include

/home/cryolite/local/4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /home/cryolite/local/4.7.0/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/cc1plus
-fpreprocessed main.ii -quiet -dumpbase main.cpp -mtune=generic -march=x86-64
-auxbase main -std=c++11 -version -o main.s
GNU C++ (GCC) version 4.7.0 2005 (experimental) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.7.0 2005 (experimental), GMP version 5.0.2,
MPFR version 3.0.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C++ (GCC) version 4.7.0 2005 (experimental) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.7.0 2005 (experimental), GMP version 5.0.2,
MPFR version 3.0.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 1c96d36acbd98a4b9c0fb64069912a60
main.cpp: In instantiation of 'void f() [with int ...IS = {0, 1, 2}]':
main.cpp:9:14:   required from here
main.cpp:4:3: internal compiler error: unexpected expression 'IS' of kind
template_parm_index
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.

cryolite@blueplanet:~/work/test$ cat main.ii
# 1 main.cpp
# 1 command-line
# 1 main.cpp
templateint... IS
void f()
{
  for (int i : IS);
}

int main()
{
  f0, 1, 2();
}


[Bug c++/51047] New: [C++0x] SFINAE does not handle errors of ambiguous base members

2011-11-08 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51047

 Bug #: 51047
   Summary: [C++0x] SFINAE does not handle errors of ambiguous
base members
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


I expect that the following code is compiled successfully.
However, the second static_assert results in a hard error without SFINAE.


==
cryolite@blueplanet:~/work/test$ LANG=C ~/local/4.7.0/bin/g++-tlimit -v
-save-temps -std=c++0x 5_2_5_5.cpp
Using built-in specs.
COLLECT_GCC=/home/cryolite/local/4.7.0/bin/g++
COLLECT_LTO_WRAPPER=/home/cryolite/local/4.7.0/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/cryolite/work/intro/gcc-4.7-2005/configure
--build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu
--target=x86_64-unknown-linux-gnu --prefix=/home/cryolite/local/4.7.0
--enable-static --enable-shared --enable-multilib --enable-threads=posix
--enable-tls --with-arch-32=i686 --with-tune=generic --enable-bootstrap
--enable-languages=c,c++ --enable-libssp --enable-libgomp --enable-targets=all
--enable-nls --enable-lto --enable-libstdcxx-debug --disable-libstdcxx-pch
Thread model: posix
gcc version 4.7.0 2005 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /home/cryolite/local/4.7.0/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/cc1plus
-E -quiet -v -D_GNU_SOURCE 5_2_5_5.cpp -mtune=generic -march=x86-64 -std=c++11
-fpch-preprocess -o 5_2_5_5.ii
ignoring nonexistent directory
/home/cryolite/local/4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../x86_64-unknown-linux-gnu/include
#include ... search starts here:
#include ... search starts here:

/home/cryolite/local/4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0

/home/cryolite/local/4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/x86_64-unknown-linux-gnu

/home/cryolite/local/4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/backward
 /home/cryolite/local/4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/include
 /usr/local/include
 /home/cryolite/local/4.7.0/include

/home/cryolite/local/4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /home/cryolite/local/4.7.0/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/cc1plus
-fpreprocessed 5_2_5_5.ii -quiet -dumpbase 5_2_5_5.cpp -mtune=generic
-march=x86-64 -auxbase 5_2_5_5 -std=c++11 -version -o 5_2_5_5.s
GNU C++ (GCC) version 4.7.0 2005 (experimental) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.7.0 2005 (experimental), GMP version 5.0.2,
MPFR version 3.0.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C++ (GCC) version 4.7.0 2005 (experimental) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.7.0 2005 (experimental), GMP version 5.0.2,
MPFR version 3.0.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 1c96d36acbd98a4b9c0fb64069912a60
5_2_5_5.cpp: In substitution of 'templateclass T decltype (declvalT().x)
f(T*) [with T = D]':
5_2_5_5.cpp:13:27:   required from here
5_2_5_5.cpp:2:44: error: request for member 'x' is ambiguous
5_2_5_5.cpp:5:16: error: candidates are: int B2::x
5_2_5_5.cpp:4:16: error: int B1::x

cryolite@blueplanet:~/work/test$ cat 5_2_5_5.ii 
# 1 5_2_5_5.cpp
# 1 command-line
# 1 5_2_5_5.cpp
templatetypename T T declval();
templateclass T decltype(declvalT().x) f(T *);
templateclass T char f(T);
struct B1{ int x; };
struct B2{ int x; };
struct D : public B1, B2{};
struct S { int x; };
int main()
{
  S *p = nullptr;
  static_assert(sizeof(f(p)) == sizeof(int), );
  D *q = nullptr;
  static_assert(sizeof(f(q)) == 1u, );
}
==


Just for reference, the following code is compiled without any error as I
expected.


==
templateclass T decltype(T::x) f(T *);
templateclass T char f(T);
struct B1{ int x; };
struct B2{ int x; };
struct D : public B1, B2{};
struct S { int x; };
int main()
{
  S *p = nullptr;
  static_assert(sizeof(f(p)) == sizeof(int), );
  D *q = nullptr;
  static_assert(sizeof(f(q)) == 1u, );
}
==


[Bug c++/50324] New: SFINAE does not handle the object creation of an incomplete type

2011-09-08 Thread ai.azuma at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50324

 Bug #: 50324
   Summary: SFINAE does not handle the object creation of an
incomplete type
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: ai.az...@gmail.com


As far as I understand correctly, the following code should be compiled
successfully.
However, the latter static_assert results in a hard error without SFINAE.


cryolite@blueplanet:~/work/test$ LANG=C /home/cryolite/local/4.7.0/bin/g++ -v
-save-temps -std=c++0x -c main.cpp
Using built-in specs.
COLLECT_GCC=/home/cryolite/local/4.7.0/bin/g++
COLLECT_LTO_WRAPPER=/home/cryolite/local/4.7.0/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.7-20110820/configure --build=x86_64-unknown-linux-gnu
--host=x86_64-unknown-linux-gnu --target=x86_64-unknown-linux-gnu
--prefix=/home/cryolite/local/4.7.0 --enable-shared --enable-multilib
--enable-threads --enable-tls --enable-languages=c,c++ --enable-nls
--enable-lto --enable-libstdcxx-debug --disable-libstdcxx-pch
Thread model: posix
gcc version 4.7.0 20110820 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++0x' '-c' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /home/cryolite/local/4.7.0/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/cc1plus
-E -quiet -v -D_GNU_SOURCE main.cpp -mtune=generic -march=x86-64 -std=c++0x
-fpch-preprocess -o main.ii
ignoring nonexistent directory
/home/cryolite/local/4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../x86_64-unknown-linux-gnu/include
#include ... search starts here:
#include ... search starts here:

/home/cryolite/local/4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0

/home/cryolite/local/4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/x86_64-unknown-linux-gnu

/home/cryolite/local/4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/backward
 /home/cryolite/local/4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/include
 /usr/local/include
 /home/cryolite/local/4.7.0/include

/home/cryolite/local/4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++0x' '-c' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /home/cryolite/local/4.7.0/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/cc1plus
-fpreprocessed main.ii -quiet -dumpbase main.cpp -mtune=generic -march=x86-64
-auxbase main -std=c++0x -version -o main.s
GNU C++ (GCC) version 4.7.0 20110820 (experimental) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.7.0 20110820 (experimental), GMP version
5.0.2, MPFR version 3.0.1, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C++ (GCC) version 4.7.0 20110820 (experimental) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.7.0 20110820 (experimental), GMP version
5.0.2, MPFR version 3.0.1, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 93b10bde50b693a2f5890ff9c833cb57
main.cpp: In substitution of 'templateclass T decltype ({})* f(T*) [with T =
incomplete]':
main.cpp:10:27:   required from here
main.cpp:3:24: error: invalid use of incomplete type 'struct incomplete'
main.cpp:2:8: error: forward declaration of 'struct incomplete'

cryolite@blueplanet:~/work/test$ cat main.ii
# 1 main.cpp
# 1 built-in
# 1 command-line
# 1 main.cpp
struct complete{};
struct incomplete;
templateclass T auto f(T *) - decltype(T{}) *;
templateclass T char f(T);
int main()
{
  complete *p = 0;
  static_assert(sizeof(f(p)) == sizeof(void*), );
  incomplete *q = 0;
  static_assert(sizeof(f(q)) == 1u, );
}