[Bug 1643538] [NEW] gcc 5 copy list initialization creates undefined reference
    sobczyk 
    1643538 at bugs.launchpad.net
       
    Mon Nov 21 12:17:12 UTC 2016
    
    
  
Public bug reported:
g++ > 5.1
introduced a regression
Following code compiled with g++ -std=c++11
#include <memory>
struct HelperArgs
{
	std::shared_ptr<bool> dummy;
};
static void freefunc(HelperArgs aa = {}) { };			// doesn't work
//static void freefunc(HelperArgs aa = HelperArgs{}) { };	// works
int main()
{
	freefunc();
	return 0;
}
creates:
g++ -std=c++11 test.cpp
/tmp/ccDj6FO4.o: In function `main':
test.cpp:(.text+0xc7): undefined reference to `std::shared_ptr<bool>::shared_ptr()'
collect2: error: ld returned 1 exit status
all clang++ compile this code fine
** Affects: gcc-5 (Ubuntu)
     Importance: Undecided
         Status: New
-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-5 in Ubuntu.
https://bugs.launchpad.net/bugs/1643538
Title:
  gcc 5 copy list initialization creates undefined reference
Status in gcc-5 package in Ubuntu:
  New
Bug description:
  
  g++ > 5.1
  introduced a regression
  Following code compiled with g++ -std=c++11
  #include <memory>
  struct HelperArgs
  {
  	std::shared_ptr<bool> dummy;
  };
  static void freefunc(HelperArgs aa = {}) { };			// doesn't work
  //static void freefunc(HelperArgs aa = HelperArgs{}) { };	// works
  int main()
  {
  	freefunc();
  	return 0;
  }
  creates:
  g++ -std=c++11 test.cpp
  /tmp/ccDj6FO4.o: In function `main':
  test.cpp:(.text+0xc7): undefined reference to `std::shared_ptr<bool>::shared_ptr()'
  collect2: error: ld returned 1 exit status
  all clang++ compile this code fine
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1643538/+subscriptions
    
    
More information about the foundations-bugs
mailing list